Skip to content

Instantly share code, notes, and snippets.

@aaronshaf
Last active March 30, 2026 23:32
Show Gist options
  • Select an option

  • Save aaronshaf/1346968 to your computer and use it in GitHub Desktop.

Select an option

Save aaronshaf/1346968 to your computer and use it in GitHub Desktop.
Copy text from Amazon's Cloud Reader. Helpful for students that need block quotes.
javascript: (function () {
new_window = window.open();
new_window.document.body.innerHTML = $("iframe")
.contents()
.find("iframe")
.contents()
.find("body")
.get(1).innerHTML;
new_window.document.body.querySelector("#content-overlays").remove();
})();
javascript:(function(){new_window=window.open();new_window.document.body.innerHTML=$("iframe").contents().find("iframe").contents().find("body").get(1).innerHTML;new_window.document.body.querySelector("#content-overlays").remove();})();
javascript: (function () {
document.body.innerHTML = $("iframe")
.contents()
.find("iframe")
.contents()
.find("body")
.get(1).innerHTML;
document.body.querySelector("#content-overlays").remove();
document.head.querySelectorAll("link[type]").item(0).remove();
Array.from(document.querySelectorAll("span.k4w")).forEach((span) => {
span.outerHTML = span.textContent;
});
})();
javascript:(function () { document.body.innerHTML = $("iframe") .contents() .find("iframe") .contents() .find("body") .get(1).innerHTML; document.body.querySelector("#content-overlays").remove(); document.head.querySelectorAll('link[type]').item(0).remove(); Array.from(document.querySelectorAll('span.k4w')).forEach((span) => { span.outerHTML = span.textContent }); })();
@bh-schmidt

Copy link
Copy Markdown

It seems it doesn't work anymore 😢

@AlexAllocated

Copy link
Copy Markdown

They got smarter.
image
I've been able to write a script for copying text from kindle cloud reader for years. Every time they'd just bury the text sneakier and sneakier but if it was in the DOM then you'd get to it eventually. Now they're rendering all the text out as images. They finally stumped me lol. I haven't dabbled with image to text before but regardless it seems like the days of the humble javascript bookmark might be postponed indefinitely.

@benjaminbauer

Copy link
Copy Markdown

@crisdias

crisdias commented Jan 3, 2023

Copy link
Copy Markdown

If you are on Windows you can try Power Toys' Text Extractor, using win-shift-T. (it handles line breaks poorly, but…)

https://learn.microsoft.com/en-us/windows/powertoys/text-extractor

@rahulbansal16

Copy link
Copy Markdown

Is there a way to fetch all the highlighted/annotated text?
I found an API that https://read.amazon.com/service/mobile/reader/getAnnotations that can fetch all the annotations but it trims the text.

annotations": [ { "action": null, "asin": "B00KHX0II4", "context": "WHENEVER I INTERVIEW someone for a job, I like to ask this question: “What important truth do very few", "deviceType": null, "dsn": "A2CTZ977SKFQZY00A1DMFVGPSDC5D6", "end": 2804, "guid": "CR!PHRBPX0FRX5Q335QZ3CR3J4D92EC", "highlightColor": null, "isSample": null, "modifiedTimestamp": 1527091882000, "note": null, "position": 2648, "positionType": "Mobi7", "start": 2648, "type": "kindle.highlight" }]

There is a context field that returns the annotated/highlighted text but it trims the text. It does not show the complete text.
Is there a way to fetch the highlights/annotated in realtime?

@ongnxco

ongnxco commented Feb 25, 2024

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment