Skip to content

Instantly share code, notes, and snippets.

@mekarpeles
Created January 23, 2023 22:29
Show Gist options
  • Save mekarpeles/fc40c5a2250cff801a3a8e28743a7cad to your computer and use it in GitHub Desktop.
Save mekarpeles/fc40c5a2250cff801a3a8e28743a7cad to your computer and use it in GitHub Desktop.
goodreads rss to ol query
var isbnList = []
fetch("https://www.goodreads.com/review/list_rss/118293813?shelf=%23ALL%23")
.then(response => response.text())
.then(data => {
let parser = new DOMParser();
let xmlDoc = parser.parseFromString(data, "application/xml");
let isbnTags = xmlDoc.getElementsByTagName("isbn");
for (let i = 0; i < isbnTags.length; i++) {
if (isbnTags[i].innerHTML !== "") {
isbnList.push(isbnTags[i].innerHTML);
}
}
console.log(`https://openlibrary.org/search?${new URLSearchParams({'q': 'isbn:(' + isbnList.join(' OR ') + ')'})}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment