Created
September 16, 2014 15:27
-
-
Save rochefort/afd52dd1cca1a7dd0702 to your computer and use it in GitHub Desktop.
5-6-1 P.286
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
diff --git a/chapter5/flickr-nokogiri.rb b/chapter5/flickr-nokogiri.rb | |
index bfa87cb..da46acc 100644 | |
--- a/chapter5/flickr-nokogiri.rb | |
+++ b/chapter5/flickr-nokogiri.rb | |
@@ -14,7 +14,7 @@ def save_image(url) | |
end | |
search_word=URI.encode("cat") | |
-doc = Nokogiri::HTML(open("https://www.flickr.com/search/?q=#{search_word}")) | |
+doc = Nokogiri::HTML(open("https://www.flickr.com/search/?text=#{search_word}")) | |
doc.xpath("//a[@class='rapidnofollow photo-click']/img") | |
.each {|link| | |
@@ -29,4 +29,4 @@ doc.xpath("//a[@class='rapidnofollow photo-click']/img") | |
url = url.gsub('.jpg','_b.jpg') | |
puts url | |
save_image(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment