Purpose
Find the Goodreads lists associated with a book identified by its title or other search query, returning each list's name, URL, and visible metadata.
When to Use
Use when the caller provides a book title, author, or search query and wants the Goodreads lists containing that book. The caller does not need to know Goodreads' opaque book ID.
Workflow
- Resolve the book ID with one direct search navigation:
https://www.goodreads.com/search?q={URL-encoded query}. - On the search results page, inspect
tr[itemtype="http://schema.org/Book"]rows and select the result whosea.bookTitleand, when supplied,a.authorNamematch the requested book. Read thea.bookTitlehref, which typically has the form/book/show/{book-id}; extract{book-id}from that URL rather than guessing it. - Navigate directly to
https://www.goodreads.com/list/book/{book-id}. - After the page is loaded, run this evaluator to extract the visible lists and pagination links:
(() => {
const clean = (s) => (s || "").replace(/\s+/g, " ").trim();
const lists = [...document.querySelectorAll("div.cell")]
.map((cell) => {
const link = cell.querySelector("a.listTitle");
return {
name: clean(link?.innerText),
href: link?.href || null,
meta: clean(cell.querySelector("div.listFullDetails")?.innerText),
};
})
.filter((item) => item.name);
const pagination = [...document.querySelectorAll("div.pagination a")]
.map((a) => ({ label: clean(a.innerText), href: a.href }))
.filter((item) => item.href);
return {
bookListsPage: location.href,
title: clean(document.querySelector("h1")?.innerText),
lists,
pagination,
};
})();- If
paginationcontains additional result-page URLs, navigate directly to those URLs and run the same evaluator, then concatenate and deduplicate results byhref. Goodreads list pages also accept the query formhttps://www.goodreads.com/list/book/{book-id}?page={page-number}; use it when pagination controls are missing or when explicitly collecting later pages. Continue until the requested pages are covered or a page returns no list entries. In a full collection, page numbers can be fetched sequentially with the same direct URL pattern rather than clicking pagination controls.
Site-Specific Gotchas
- Goodreads uses an opaque numeric book ID in
/list/book/{book-id}; always obtain it from a matching search-result book URL. - Search results are book rows selected by
tr[itemtype="http://schema.org/Book"]; usea.bookTitlefor the title anda.authorNamefor author disambiguation. - The lists page stores individual entries in
div.cell; the list link isa.listTitleand descriptive text is indiv.listFullDetails. - Search matching should tolerate Goodreads title punctuation and case differences, but prefer an author match when multiple editions or similarly titled books appear.
- List pagination uses the
pagequery parameter on the book-specific lists URL, even when pagination links are not readily visible in the page DOM. - Deduplicate entries across pages by their canonical list
href, because pagination results should be stitched into one collection.
Expected Output
Return the resolved book identity and an array of objects with name, href, and meta for every extracted Goodreads list, optionally including pagination URLs when more pages are available.