Created
August 13, 2014 18:52
-
-
Save pheuter/9b108bd425cd9d405308 to your computer and use it in GitHub Desktop.
Rick Ross image scraper using Nokogiri (鋸)
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' | |
i = 0 | |
file = File.new "ross_image_urls.txt", "w" | |
50.times do | |
imageUrls = Nokogiri::HTML(open(URI.escape("https://www.google.com/search?q=rick+ross&biw=1301&bih=442&sei=WKvrU9nIJ43gsASAxYHQDQ&tbm=isch&ijn=2&ei=WKvrU9nIJ43gsASAxYHQDQ&start=#{i}"))).css('img').each do |image| | |
file.puts image['data-src'] | |
end | |
i += 20 | |
end | |
file.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment