Last active
May 17, 2016 17:40
-
-
Save abele/e2f6848a84400703563d8c558e91d1bb to your computer and use it in GitHub Desktop.
Export Amazon content list to CSV file
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
/** | |
var bookView = 'https://www.amazon.com/mn/dcw/myx.html#/home/content/booksAll/dateDsc/'; | |
*/ | |
function downloadContentCSV() { | |
var lis = [].slice.call(document.querySelector('.nav.nav-grid.ui-grid').querySelectorAll('li')), | |
csvContent = 'data:text/csv;charset=utf-8,'; | |
lis.forEach(function (el, i) { | |
var title = el.querySelector('#title' + i).innerHTML, | |
author = el.querySelector('#author' + i).innerHTML, | |
row = `${i}, "${title}", "${author}"`; | |
csvContent += row + '\n'; | |
}); | |
console.log(csvContent); | |
var encodedUri = encodeURI(csvContent); | |
window.open(encodedUri); | |
} | |
downloadContentCSV(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment