Created
August 17, 2011 16:37
-
-
Save sunnyone/1151964 to your computer and use it in GitHub Desktop.
Amazon links to ASIN/Title table
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
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