% ruby scrape_test.rb "About - Spinor Lab" "HomeAboutWebSDRIC-7410 Rig ControlSoftware Defined RadioSoftwareAntennaMorse Keys and PaddlesLoTWeQSLLinksSitemapHome (in Japanese)Type: Squid-faced HumanoidsAffiliated with: Second Great and Bountiful Human EmpireHome planet: Ood Sphere, Horsehead Nebula SKCC: #11158\n" % nokogiri --version # Nokogiri (1.8.0) % ruby --version ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin16]
require 'nokogiri' require 'open-uri' url = 'https://spinorlab.matrix.jp/en/about/' charset = nil html = open(url) do |f| charset = f.charset f.read end doc = Nokogiri::HTML.parse(html, nil, charset) list = doc.search('li') p doc.title p list.text list.each do |t| p t.text end
% ruby scrape_test.rb "About - Spinor Lab" "HomeAboutWebSDRIC-7410 Rig ControlSoftware Defined RadioSoftwareAntennaMorse Keys and PaddlesLoTWeQSLLinksSitemapHome (in Japanese)Type: Squid-faced HumanoidsAffiliated with: Second Great and Bountiful Human EmpireHome planet: Ood Sphere, Horsehead Nebula SKCC: #11158\n" "Home" "About" "WebSDR" "IC-7410 Rig Control" "Software Defined Radio" "Software" "Antenna" "Morse Keys and Paddles" "LoTW" "eQSL" "Links" "Sitemap" "Home (in Japanese)" "Type: Squid-faced Humanoids" "Affiliated with: Second Great and Bountiful Human Empire" "Home planet: Ood Sphere, Horsehead Nebula" "SKCC: #11158\n"
require 'nokogiri' require 'open-uri' doc = Nokogiri::HTML(open('http://nuttycellist-unknown.blogspot.jp/')) doc.css('h2.date-header', 'h3.post-title a').each do |t| puts t.text end
% ruby scrape_test2.rb 8/10/2017 8/05/2017 7/31/2017 7/18/2017 7/09/2017 7/06/2017 Seventy two years have passed Lorin WA1PGB It's the season of Indian Lilac In commemoration of my history Discussing proper sending way of CW Kidney beans and carrot rolled with pork My Father's 13th Anniversary