Skip to content

Instantly share code, notes, and snippets.

@sunnyone
Created August 17, 2011 16:37
Show Gist options
  • Save sunnyone/1151964 to your computer and use it in GitHub Desktop.
Save sunnyone/1151964 to your computer and use it in GitHub Desktop.
Amazon links to ASIN/Title table
var ar = document.getElementsByTagName("a"); var text = "";
for (var i = 0; i < ar.length; i++) {
if (ar[i].href != null && ar[i].href.match(/gp\/product\/[0-9]{10}\//)) {
var asin = ar[i].href.replace(/.*product\//, '').replace(/\/ref=.*/, '');
var title = ar[i].text; text = text + "<tr><td>" + asin + "</td><td>" + title + "</td></tr>";
}
}
var table = document.createElement('table');
table.innerHTML = text;
document.body.appendChild(table);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment