Search a Google Books volume by keyword, identify matching scan-page identifiers, inspect corresponding OCR/text views, and report relevant passages with scan-page citations. When the caller already supplies scan-page identifiers, jump directly to those pages.
Use Cases
Use when the caller supplies a Google Books volume ID and wants passages, quotations, or page references from a scanned book. The volume must expose searchable text or a full/partial preview. Run separate searches for spelling variants, inflections, or related terms when needed. If requested scan-page identifiers are already known, search can be skipped.
Automation Flow
- If the caller supplies only a volume ID and terms, construct the search URL directly; do not visit the homepage or type into the search box:
https://books.google.nl/books?id={book-id}&printsec=frontcover&hl={language}#v=onepage&q={url-encoded-query}&f=false - Navigate to that URL and run this evaluator on the search-results page. It returns visible OCR/search text and every linked page identifier, commonly
pg=PA{n}:(() => { const links = [...document.querySelectorAll('a[href*="pg="]')] .map((a) => ({ text: (a.innerText || a.textContent || "").trim(), href: a.href, })) .filter((x) => /(?:^|[?&])pg=/.test(x.href)); const pages = [ ...new Map( links.map((x) => { const m = x.href.match(/[?&]pg=([^&#]+)/); return [m ? decodeURIComponent(m[1]) : x.href, x]; }), ).values(), ]; return { url: location.href, queryText: (document.body.innerText || "").trim(), pages, pageIds: pages .map((x) => { const m = x.href.match(/[?&]pg=([^&#]+)/); return m ? decodeURIComponent(m[1]) : null; }) .filter(Boolean), }; })(); - If scan-page identifiers are explicitly supplied by the caller or returned by step 2, navigate directly to each relevant page. The compact text endpoint is:
https://books.google.nl/books?pg={page-id}&redir_esc=y&id={book-id}&hl={language}&output=textA directly observed HTML-text variant is also valid:https://books.google.nl/books?id={book-id}&pg={page-id}&hl={language}&output=html_textUse the supplied or resolved page token verbatim; do not invent opaque identifiers. - On each loaded text-view page, run this evaluator:
(() => { const text = (document.body.innerText || "").trim(); const pageId = new URL(location.href).searchParams.get("pg") || document.querySelector("#jtp")?.value || null; const prev = document.querySelector("#legacy-text-prev")?.href || null; const next = document.querySelector("#legacy-text-next")?.href || null; const pageMatch = String(pageId || "").match(/(?:PA|PP)(\d+)/i); return { url: location.href, pageId, scanPage: pageMatch ? Number(pageMatch[1]) : null, text, prev, next, }; })(); - Follow
nextorprevonly when the relevant passage continues onto adjacent pages or the caller requests a broader section. Deduplicate page IDs and report eachPA...identifier together with any printed page number visible in the OCR. Quote only matching passages and briefly explain their relevance.
Optional query variants
- Insert terms into the
qfragment parameter and URL-encode them. - For historical Dutch text, search singular/plural and spelling variants separately, such as
{query},{query}-en, or alternate orthography. - Keep the volume ID fixed across searches; a result from another volume is not evidence for the requested book.
- When checking a page range, include the explicitly requested scan pages and adjacent pages only if continuity or the task requires it.
Possible Friction Points
- Google Books uses an opaque volume ID in
id={book-id}and scan-page identifiers such asPA79; use the supplied volume ID and read page IDs from result links instead of guessing them. - The reader hash search URL and legacy
output=textURL serve different purposes: the hash exposes search hits, whileoutput=textis a compact page-level OCR view. The directly observedoutput=html_textURL is an alternative page-level text view when a page token is already known. - Search results may expose only snippets or links. Inspect each relevant
PA...page through a text endpoint before quoting it. - OCR in historical Dutch can miss accents, ligatures, or inflections. Search multiple variants and manually verify surrounding OCR text against the scan when distinctions between terms matter.
- Some pages may not expose text or may show limited preview content. Preserve the page identifier and report unavailable OCR rather than substituting text from another edition or volume.
- The
PAnumber is the scan/page identifier used by Google Books; distinguish it from a printed page number if both appear in the page text.