Skip to content

Instantly share code, notes, and snippets.

@misfo
Created October 20, 2014 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save misfo/df519c7d63da68d9aa3c to your computer and use it in GitHub Desktop.
Save misfo/df519c7d63da68d9aa3c to your computer and use it in GitHub Desktop.
Scrape the Amazon Subscribe 'n' Save page w/ artoo.js
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