Last active
April 28, 2019 20:38
-
-
Save Camvillard/0cc4d7b5f5093ae02e43a221eb18fa6b to your computer and use it in GitHub Desktop.
Scrape HTML . using open-uri & nokogiri gems
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
url = "http://www.letscookfrench.com/recipes/find-recipe.aspx?s=chocolate" | |
html_file = open(url).read | |
html_doc = Nokogiri.HTML(html_file) | |
html_doc.search('.m_titre_resultat a').each do |element| | |
puts element.text.strip | |
puts element.attribute('href').value | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment