{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "true" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "require 'nokogiri'\n", "require 'httparty'" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "131416" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "page = Nokogiri::HTML(HTTParty.get('https://github.com/localhostdotdev?tab=repositories&q=&type=public&language='))\n", "page.to_html.size" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " notebooks\n", " bug\n", " website\n", " ruby-twitter\n", " example-.io-game\n", " localhostdotdev.github.io\n", " real-rails-issues\n", " capybara-screenshot\n", " paper_trail\n", " shoulda-context\n", " delayed_cron_job\n", " rails\n", " plugin-ruby\n", " unidecoder\n", " hacker-news-undocumented\n", " file-line\n", " delayed_job\n", " heroku-buildpack-libsodium\n", " bundler-stats\n", " API\n", " minitest-rails\n", " chromedriver-helper\n", " sdoc\n", " rails-docs-server\n", " discordrb\n", " mitmengine\n", " rumouse\n", " lobsters-postgresql\n", " jit\n", " websocket-client-simple" ], "text/plain": [ "[#, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>, #, #] children=[#]>]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "links = page.css('a[itemprop=\"name codeRepository\"]')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "\"\"" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "IRuby.html(\n", " \"\"\n", ")" ] } ], "metadata": { "kernelspec": { "display_name": "Ruby 2.6.2", "language": "ruby", "name": "ruby" }, "language_info": { "file_extension": ".rb", "mimetype": "application/x-ruby", "name": "ruby", "version": "2.6.2" } }, "nbformat": 4, "nbformat_minor": 2 }