Skip to content

Instantly share code, notes, and snippets.

@cdrini
Last active July 13, 2020 21:58
Show Gist options
  • Save cdrini/1ed9a3f2e3e19ec9bb0daa308ebc3edf to your computer and use it in GitHub Desktop.
Save cdrini/1ed9a3f2e3e19ec9bb0daa308ebc3edf to your computer and use it in GitHub Desktop.
Misc ia snippets
// Run anywhere on dev.openlibrary.org in console
var edition_ocaids = `
isbn_9780316253017
olivertwist01dick
`.trim().split('\n').map(x => x.trim())
var url = 'https://dev.openlibrary.org/search.json?' + new URLSearchParams({
q: `ia:(${removed_ocaids.join(' OR ')})`,
fields: 'key,ia',
limit: removed_ocaids.length
});
console.log(url);
var resp = await fetch(url).then(r => r.json());
var all_work_ocaids = Array.from(new Set(resp.docs.flatMap(d => d.ia)));
all_work_ocaids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment