Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Just paste this into the console of your audible library and run it and it will compile an object of basic information of all the books (shown) in your library. This is brittle and depends on their html structure remaining the same. If they change it, this could no longer work.
let tables = document.getElementsByTagName('table');
let rows = tables[2].getElementsByTagName('tr');
let books = [];
for (let i = 0; i < rows.length; i++) {
try {
// It's generally a normal row if there is a fourth cell
if (rows[i].cells[3]) {
let url = rows[i].cells[3].children[0].href;
let title = rows[i].cells[3].children[0].innerText;
let author = "";
if (rows[i].cells[4].children) {
author = rows[i].cells[4].children[0].innerText;
let length = "";
if (rows[i].cells[5].children[0]) {
length = rows[i].cells[5].children[0].innerText;
let imageUrl = rows[i].cells[1].children[0].src
let book = {
url: url,
title: title,
author: author,
length: length,
imageUrl: imageUrl
// Child rows (books with multiple parts) don't have imageUrls
if (imageUrl) {
// Replace image url with better quality
book.imageUrl = book.imageUrl.replace("SL80", "SL300");
} catch (error) {
console.log(`Error in ${i} `, rows[i], error);
console.log("pretty books", books);
console.log("Stringified books", JSON.stringify(books));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.