Last active
August 29, 2015 13:56
-
-
Save workmad3/8974238 to your computer and use it in GitHub Desktop.
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
namespace :scrape do | |
desc "Take a screenshot of a url using Phantomjs" | |
task :screenshots => :environment do | |
require 'capybara' | |
require 'poltergeist/capybara' | |
include Capybara::DSL | |
Capybara.default_driver = :poltergeist | |
articles = Article.order('zscore DESC').limit(3) | |
articles.each_with_index do |article, i| | |
visit article.url | |
screenshot_and_save_page | |
sleep 4 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment