Last active
June 1, 2024 22:51
-
-
Save jkubecki/d61d3e953ed5c8379075b5ddd8a95f22 to your computer and use it in GitHub Desktop.
Amazon Kindle Export
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
// The following data should be run in the console while viewing the page https://read.amazon.com/ | |
// It will export a CSV file called "download" which can (and should) be renamed with a .csv extension | |
var db = openDatabase('K4W', '3', 'thedatabase', 1024 * 1024); | |
getAmazonCsv = function() { | |
// Set header for CSV export line - change this if you change the fields used | |
var csvData = "ASIN,Title,Authors,PurchaseDate\n"; | |
db.transaction(function(tx) { | |
tx.executeSql('SELECT * FROM bookdata;', [], function(tx, results) { | |
var len = results.rows.length; | |
for (i = 1; i < len; i++) { | |
// Get the data | |
var asin = results.rows.item(i).asin; | |
var title = results.rows.item(i).title; | |
var authors = JSON.parse(results.rows.item(i).authors); | |
var purchaseDate = new Date(results.rows.item(i).purchaseDate).toLocaleDateString(); | |
// Remove double quotes from titles to not interfere with CSV double-quotes | |
title = title.replace(/"/g, ''); | |
// Concatenate the authors list - uncomment the next line to get all authors separated by ";" | |
// var authorList = authors.join(';'); | |
// OR Take only first author - comment the next line if you uncommented the previous one | |
var authorList = authors[0]; | |
// Write out the CSV line | |
csvData += '"' + asin + '","' + title + '","' + authorList + '","' + purchaseDate + '"\n' | |
} | |
// "Export" the data | |
window.location = 'data:text/csv;charset=utf8,' + encodeURIComponent(csvData); | |
console.log("Sample Row:"); | |
console.log(results.rows.item(1)); | |
}); | |
}); | |
}; | |
getAmazonCsv(); |
The Amazon manage your content is slow and inflexible and is tedious, the
new your books is hopeless for large libraries, like more than 200 books
IMO.
Plus I want my extensive Kindle library AND my extensive physical real-book
library to be indexed TOGETHER.
…On Wed, Nov 22, 2023, 00:01 SlyJackHammer ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
@johnnew2019 <https://github.com/johnnew2019> @heathkat
<https://github.com/heathkat> May I know what you do with your list of
Kindle books? I want to understand the need better so when I have time I
can develop this project further.
I see a lot of people wanting a csv/excel sheet of their books, but I'm
not sure why. I own many Kindle books too but I don't have this need.
Several use cases for me:
- personal library catalog, able to be imported into other library
programs (calibre, for instance). Your csv is a good first step towards
this. Amazon's own system isn't always intuitive for a "scanning your
shelves for something to read" experience
- as a base for search. I own digital books in several platforms, a
total of thousands, and it becomes a pain when considering buying a new
book, to know whether I already own it. Requires login to each of the web
platforms, manual search, etc. Have been considering how to write a
programmatic solution for this for years. None of the services offer APIs
for this use case, though, so I'm stuck with parsing a signed-in account
via JS.
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/jkubecki/d61d3e953ed5c8379075b5ddd8a95f22#gistcomment-4769077>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA7YLBGRSYKMQIYFV7DCM7LYFWWLZBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA2DANZVHEYDMNNHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
This sounds exactly what I have been looking for - a version that works with https://read.amazon.co.uk/kindle-library rather than .com would be great.
One of the key things I want to do is tag and group the books I haven't read yet. Some would be best read in a certain order.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Several use cases for me: