Skip to content

Instantly share code, notes, and snippets.

@abele
Last active May 17, 2016 17:40
Show Gist options
  • Save abele/e2f6848a84400703563d8c558e91d1bb to your computer and use it in GitHub Desktop.
Save abele/e2f6848a84400703563d8c558e91d1bb to your computer and use it in GitHub Desktop.
Export Amazon content list to CSV file
/**
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