Skip to content

Instantly share code, notes, and snippets.

@aaronshaf
Last active February 25, 2024 18:56
Show Gist options
  • Star 57 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save aaronshaf/1346968 to your computer and use it in GitHub Desktop.
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 }); })();
Copy link

ghost commented Apr 18, 2013

If someone dont know how to install it ( as me )

  1. Click into open book in CloudReader
  2. Ctrl + Shift +J
  3. step 2 opened new window and there just Ctrl + V for copied code line ( doesn´t matter which one as I see ), after that just press Enter
  4. There is opened new tab which contains some piece of text from nearest pages in area when you clicked in CloudReader

THX aaronshaf, it´s working.

@ccimpoi
Copy link

ccimpoi commented Jul 23, 2013

This will enable copy to clipboard for the highlighted text: https://github.com/binarycrafts/ACRExtensions

@AndrewCh
Copy link

Please take a look at Kindle Optimizer Chrome Extension that may help you.
https://chrome.google.com/webstore/detail/kindle-optimizer/bjfeinekchekdofcdmnfcnbidjkpbgdh

Adds instant Google Search and Translate functionality to the Kindle Cloud Reader.
If you want to

  • Search text from Kindle Cloud Reader in Google in an instance
  • Translate text from Kindle Cloud Reader in Google in an instance
  • Copy text from Kindle Cloud Reader into in Google Search with ease

Than Kindle Optimizer extension is just for you!

How to use:

  1. Add Kindle Optimizer from Chrome Web Store.
  2. Login into your Kindle Cloud Reader account.
  3. Enjoy!

Known issue:

  1. First time a text is selected additional 'GSearch' tab may not appear in pop-up
    (the workaround is to select text again).

NOTE: It is based on the Open Source code from here
https://github.com/binarycrafts/ACRExtensions

@Neurogami
Copy link

@pushkarajthorat
Copy link

pushkarajthorat commented Jan 21, 2020

there are multiple iframe elements, we should pick up the last iframe instead, use this snippet instead

javascript:(function(){ 
ihtml="";
d=$('iframe').contents().find('iframe');
for(i=0;i<d.length;i++){ihtml=d[i].contentWindow.document.body.innerHTML;}
new_window=window.open();
new_window.document.body.innerHTML=ihtml;
})();


@cryptshell
Copy link

Making it a bookmarklet was the best idea ever, thanks! I've been trying to find a solution for this for a while now. Worked like a charm.

I made a bookmarklet version: https://gist.github.com/Neurogami/cc4a2224632f491c18cfce782cd706f6

@mattdimicelli
Copy link

I made a bookmarklet version: https://gist.github.com/Neurogami/cc4a2224632f491c18cfce782cd706f6

Thank you, this is awesome!

@DimaAxm
Copy link

DimaAxm commented Jun 28, 2021

Don't work today. Can you help?

@mrkuramoto
Copy link

I have tried all the tips and no one worked. Problems with "inner.HTML" or "nothing happened".... Can you help?

@bh-schmidt
Copy link

It seems it doesn't work anymore 😢

@catdadcode
Copy link

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

@crisdias
Copy link

crisdias commented Jan 3, 2023

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

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
Copy link

ongnxco commented Feb 25, 2024

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