Yet another example.
require 'open-uri' require 'nokogiri' #url = "http://psk31.cocolog-nifty.com/digitalmode/" url = "http://psk31.cocolog-nifty.com/digitalmode/2017/09/2017-6e90.html" loop do charset = nil html = open(url) do |f| charset = f.charset f.read end doc = Nokogiri::HTML.parse(html, nil, charset) url = doc.css('.entry-nav').css('a').attribute('href').value if url == 'http://psk31.cocolog-nifty.com/digitalmode/' then break end print '<span style="margin-right: 20px">' << doc.at_css('.entry-nav + h2').text << '</span>' print doc.at_css('.entry-nav').at_css('a').to_html.gsub(/« /, "") puts '<br>' end
Initial URL is manually adjusted to keep the code simple.
The link is https://spinorlab.matrix.jp/en/psk31/