Skip to content

Instantly share code, notes, and snippets.

@lightningdb
Last active November 22, 2023 17:36
Show Gist options
  • Save lightningdb/cfee260c3b7af7e65fce to your computer and use it in GitHub Desktop.
Save lightningdb/cfee260c3b7af7e65fce to your computer and use it in GitHub Desktop.
Add to Goodreads from Amazon.com book page bookmarklet
javascript: var asin_elements, asin;asin_elements = document.getElementsByName('ASIN'); if (asin_elements.length == 0) { asin_elements = document.getElementsByName('ASIN.0'); };if (asin_elements.length == 0) { alert('Sorry, this doesn\'t appear to be an Amazon book page.'); }else { asin = asin_elements[0].value; if (asin.match(/\D/) === null) { var x = window.open('http://www.goodreads.com/review/isbn/'+ asin, 'add_review'); } else { var x = window.open('https://www.goodreads.com/search?q='+ asin); } x.focus();}
@lightningdb
Copy link
Author

Terrific! Glad you were able to make something work :)

@SirGryphin
Copy link

This wasn't working for me with Kindle books kept loading goodreads and saying Page Unavailable An unexpected error occurred. We will investigate this problem as soon as possible — please check back soon! So I changed the following URLs and seems to be working now. Tested on Kindle, Paperback and Hardback and goodreads loads each time.

Changed:

var x = window.open('https://www.goodreads.com/search?q='+ asin);

To:

var x = window.open('https://www.goodreads.com/book/isbn?isbn='+ asin);

Working Bookmarklet:

javascript: var asin_elements, asin;asin_elements = document.getElementsByName('ASIN'); if (asin_elements.length == 0) { asin_elements = document.getElementsByName('ASIN.0'); };if (asin_elements.length == 0) { alert('Sorry, this doesn\'t appear to be an Amazon book page.'); }else {  asin = asin_elements[0].value;  if (asin.match(/\D/) === null) { var x = window.open('http://www.goodreads.com/review/isbn/'+ asin, 'add_review'); } else { var x = window.open('https://www.goodreads.com/book/isbn?isbn='+ asin); } x.focus();}

@lightningdb
Copy link
Author

Awesome, thanks @SirGryphin

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