Skip to content

Instantly share code, notes, and snippets.

@Kazuma
Created October 3, 2012 06:47
Show Gist options
  • Select an option

  • Save Kazuma/3825448 to your computer and use it in GitHub Desktop.

Select an option

Save Kazuma/3825448 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
wishlist_url = ''
html = Nokogiri::HTML(open(wishlist_url), nil, 'sjis')
name = html.at('//div[@id="profile"]/h1').text
birthday = html.at('//div[@id="profile"]/div[@id="profileInfo"]/table/tr[3]/td').text
puts name, birthday
@naoto

naoto commented Oct 3, 2012

Copy link
Copy Markdown
html = html.at('//div[@id="profile"]/h1').text

がいいかなー。
// から始まるとxpathと勝手に認識してくれた気がする

@Kazuma

Kazuma commented Oct 3, 2012

Copy link
Copy Markdown
Author

at ってのがあるのかー知らなかった

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment