Last active
August 29, 2015 14:15
-
-
Save randallreedjr/e49450d97a66da2250ed to your computer and use it in GitHub Desktop.
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
def index | |
urls = %w[http://cltampa.com/blogs/potlikker http://cltampa.com/blogs/artbreaker http://cltampa.com/blogs/politicalanimals http://cltampa.com/blogs/earbuds http://cltampa.com/blogs/dailyloaf http://cltampa.com/blogs/bedpost] | |
@final_images = [] | |
@final_urls = [] | |
urls.each do |url| | |
blog = Nokogiri::HTML(open(url)) | |
images = blog.xpath('//*[@class="postBody"]/div[1]//img/@src') | |
images.each do |image| | |
@final_images << image | |
end | |
story_path = blog.xpath('//*[@class="postTitle"]/a/@href') | |
story_path.each do |path| | |
@final_urls << path | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment