Skip to content

Instantly share code, notes, and snippets.

@to-osaki
Created August 20, 2020 04:56
Show Gist options
  • Save to-osaki/19c8617a1335c87cb8afe182aa6376bd to your computer and use it in GitHub Desktop.
Save to-osaki/19c8617a1335c87cb8afe182aa6376bd to your computer and use it in GitHub Desktop.
require 'mechanize'
require 'nokogiri'
agent = Mechanize.new
page = agent.get("http://yourei.jp/%E6%A4%9C%E7%B4%A2")
doc = page # Nokogiri::HTML.parse(File.read("body.html"))
table = doc.search("#sentence-example-list")
table.search("span.the-sentence").each do |node|
puts node.inner_text
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment