Created
July 8, 2010 14:19
-
-
Save anonymous/468069 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
desc "Fetch affiliate offers" | |
task :getoffers => :environment do | |
require 'mechanize' | |
agent = WWW::Mechanize.new | |
agent.get("http://odigger.com/Find-All-Affiliate-Programs") | |
agent.page.search("td.left a").each do |offer| | |
Offer.create!(:name => offer.text.strip) | |
end | |
agent.get("http://odigger.com/Find-All-Affiliate-Programs?&pg=2") | |
agent.page.search("td.left a").each do |offer| | |
Offer.create!(:name => offer.text.strip) | |
end | |
agent.get("http://odigger.com/Find-All-Affiliate-Programs?&pg=3") | |
agent.page.search("td.left a").each do |offer| | |
Offer.create!(:name => offer.text.strip) | |
end | |
agent.get("http://odigger.com/Find-All-Affiliate-Programs?&pg=4") | |
agent.page.search("td.left a").each do |offer| | |
Offer.create!(:name => offer.text.strip) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment