-
-
Save ssaunier/6109e2c29740bf670c593176862b1641 to your computer and use it in GitHub Desktop.
TimeOut best pubs scraper
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 characters
require "open-uri" | |
require "nokogiri" | |
url = "https://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").take(12).each do |bar| | |
p bar.search("img")[0].attr("src") # image_url | |
p bar.search("h3 a")[0].text # name | |
p bar.search(".listings_flag")[0].text.strip # address | |
puts "*" * 50 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment