Created
August 17, 2016 16:12
-
-
Save Papillard/04e99cab064fadcbbf0ff8be54ec84a5 to your computer and use it in GitHub Desktop.
TimeOut best pubs scraper
This file contains 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 characters
require "open-uri" | |
require "nokogiri" | |
url = "http://www.timeout.com/london/bars-and-pubs/the-100-best-bars-and-pubs-in-london" | |
html_file = open(url) | |
doc = Nokogiri::HTML(html_file) | |
doc.search(".feature-item").each do |bar| | |
p bar.search("img")[0].attr("src") | |
p bar.search("h3 a")[0].text | |
p bar.search(".listings_flag")[0].text.strip | |
puts "*" * 50 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment