lib/scraper/movies.rb in ascraper-0.0.3 vs lib/scraper/movies.rb in ascraper-0.0.4
- old
+ new
@@ -29,10 +29,14 @@
result.tags << tag.content
end
movie = Nokogiri::HTML(open(url))
- result.images = movie.at_css('.image').search('a').map {|a| a['href']}.collect! {|x| x if %r{\Ahttps?:\/\/.+\.(?:jpe?g|png)\z}.match(x) }.compact.inspect
+ result.images = []
+
+ movie.at_css('.image').search('a').map {|a| a['href']}.collect! {|x| x if %r{\Ahttps?:\/\/.+\.(?:jpe?g|png)\z}.match(x) }.compact.each do |image|
+ result.images << image
+ end
result.download_links = []
movie.css('.postarea p').each do |p|
result.download_links << p.content
\ No newline at end of file