Created
June 8, 2020 03:43
-
-
Save tomoya55/48b6cb06ba68f11cf0713f17a207b555 to your computer and use it in GitHub Desktop.
Parse Amazon unlimited loaned books
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
const title = (e) => $('div.a-column:nth-child(2) .a-row:nth-child(1) span', e).text().trim(); | |
const authors = (e) => $('div.a-column:nth-child(2) .a-row:nth-child(2) span', e).text().trim(); | |
const started = (e) => $('div.a-column:nth-child(3) .a-row:nth-child(1) span', e).text().trim(); | |
const data = []; | |
$('#itemsList .item').each((i, e) => data.push({title: title(e), authors: authors(e), started: started(e)})); | |
$('<a></a>') | |
.attr('id','downloadJSON') | |
.attr('href','data:application/json;charset=utf8,' + encodeURIComponent(JSON.stringify(data))) | |
.attr('download','unlimited.json') | |
.appendTo('body'); | |
$('#downloadJSON').get(0).click(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment