Created
September 18, 2011 10:03
-
-
Save 3dd13/1224940 to your computer and use it in GitHub Desktop.
Revisions
-
3dd13 revised this gist
Sep 18, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ # install it if you haven't done it: # sudo gem install mechanize # require 'mechanize' agent = Mechanize.new page = agent.get("http://www.openrice.com/english/restaurant/sr2.htm?shopid=32108") -
3dd13 created this gist
Sep 18, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ # # loading the mechanize library for scraping # install it if you haven't done it: # sudo gem install mechanize # require ‘mechanize’ agent = Mechanize.new page = agent.get("http://www.openrice.com/english/restaurant/sr2.htm?shopid=32108") # # use the css selector to identify the address HTML tag element # specify [2] because the address stays in the third td tag element # address_element = page.search("table.addetail tbody tr td div table tbody tr td")[2] puts address_element.text