Skip to content

Instantly share code, notes, and snippets.

@Kazuma
Created October 3, 2012 06:47
Show Gist options
  • Save Kazuma/3825448 to your computer and use it in GitHub Desktop.
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
Copy link

naoto commented Oct 3, 2012

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

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

@Kazuma
Copy link
Author

Kazuma commented Oct 3, 2012

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

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