Created
October 20, 2014 15:58
-
-
Save misfo/df519c7d63da68d9aa3c to your computer and use it in GitHub Desktop.
Scrape the Amazon Subscribe 'n' Save page w/ artoo.js
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
artoo.scrape('.subscriptions .subscription', { | |
name: function() { | |
return $.trim($(this).find('.productLink a').text()); | |
}, | |
price: function() { | |
var match = $(this).find('.priceInformation').text().match(/Current price:\s+\$(\d+\.\d+)/); | |
return match ? match[1] : ''; | |
}, | |
"interval in months": function() { | |
var match = $(this).find('.frequency').text().match(/every\s+(?:(\d)\s+)?month/); | |
return match ? (match[1] || "1") : ''; | |
} | |
}, artoo.saveCsv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment