-
-
Save MignonBelongie/02019888af8a44811850458d891350e2 to your computer and use it in GitHub Desktop.
javascript: (() => { document.querySelectorAll('#searchResults li.searchResultItem').forEach(el => { a = el.querySelector('.resultTitle a'); u = a.getAttribute('href').split('?')[0]; fetch(u + '/editions.json/').then(r => r.json()).then((j) => { ees = j.entries.filter(e => e.languages && e.languages[0].key == '/languages/eng'); ees2 = ees.filter(e => e.covers); ee = ees2.length? ees2[0] : ees.length? ees[0] : 0; if (ee) { el.querySelector('.resultTitle a').innerHTML = ee.title; if (ee.covers && ee.covers.length) { i = `//covers.openlibrary.org/b/id/${ee.covers[0]}-M.jpg`; el.querySelector('img').setAttribute('src', i) } } }) }) })(); |
thanks for making this @MignonBelongie. I really like it. It was something I thought about before and wrote about in internetarchive/openlibrary#2601.
I want to add to this, so I created this github issue: internetarchive/openlibrary#6032 that hopefully adds onto the push for internationalization of the open library and takes your work to the next level by having permanence on the open library. Maybe you can use the bookmarklet to translate the titles, so you can import it to the open library website when you fill it in for the works page.
This fails if there are orphaned editions, e.g. https://openlibrary.org/books/OL16888076M/M%C3%A9moires_sur_la_R%C3%A9volution_fran%C3%A7aise for author https://openlibrary.org/authors/OL2404578A/Fran%C3%A7ois-Claude-Amour_marquis_de_Bouill%C3%A9
It might be worth adding a couple of words about how to use this -- and perhaps copy some of the description from the page that links here: https://openlibrary.org/developers/bookmarklets
For other languages, replace /eng with the appropriate language code.