{"record":{"id":"910a3de0db55941b","repo":"jackwener/OpenCLI","slug":"zlibrary-info","errorCode":null,"errorMessage":"zlibrary info","messagePattern":"zlibrary info","errorType":"error_code","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/zlibrary/info.js","lineNumber":33,"sourceCode":"    {\n      name: 'url',\n      positional: true,\n      required: true,\n      help: 'Z-Library book page URL (e.g. https://z-library.im/book/...)',\n    },\n  ],\n  columns: ['title', 'pdf', 'epub', 'url'],\n  func: async (page, args) => {\n    const url = normalizeZlibraryBookUrl(args.url);\n\n    await page.goto(url, { waitUntil: 'load', settleMs: 3000 });\n    await page.wait({ time: 5 });\n\n    const title = await extractBookTitle(page);\n    const formats = await extractFormats(page);\n\n    if (!title || (!formats.pdf && !formats.epub)) {\n      throw new EmptyResultError(\n        'zlibrary info',\n        'Could not extract a book title and download formats. Check the URL, login state, and whether Z-Library changed its page layout.',\n      );\n    }\n\n    return [\n      {\n        title,\n        pdf: formats.pdf || '',\n        epub: formats.epub || '',\n        url,\n      },\n    ];\n  },\n});\n","sourceCodeStart":15,"sourceCodeEnd":49,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/zlibrary/info.js#L15-L49","documentation":"The zhihu... (zlibrary) info command throws EmptyResultError (code EMPTY_RESULT, exit 66) when it can neither extract a book title nor any PDF/EPUB download formats from the book page. The library signals \"no usable data\" so scripts can distinguish empty results from crashes.","triggerScenarios":"Running `zlibrary info` with a book URL whose page did not render the expected title/format elements: not logged in, wrong/redirected URL, or Z-Library changed its page layout so extractBookTitle/extractFormats return nothing.","commonSituations":"Session expired so the page shows a login wall, using a mirror domain whose HTML differs, Z-Library updating their markup, or passing a non-book URL (search page, account page).","solutions":["Log in to Z-Library in the controlled browser and retry","Verify the URL points to an actual book detail page (/book/...)","Update the zlibrary adapter if Z-Library changed its layout (check for newer version)","Try a different Z-Library mirror/origin that matches the allowed hosts"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure URL is a book page under the allowed host before calling info\nconst u = new URL(bookUrl);\nif (!u.pathname.startsWith('/book/')) throw new Error('not a book detail page: ' + bookUrl);","typeGuard":null,"tryCatchPattern":"try {\n  rows = await zlibraryInfo({ url: bookUrl });\n} catch (e) {\n  if (e?.code === 'EMPTY_RESULT') {\n    // check login state / retry on another mirror / surface hint to user\n  }\n  throw e;\n}","preventionTips":["Log in to Z-Library before running info","Use canonical /book/... URLs from search results","Handle exit code 66 in scripts as \"no data\", not crash","Keep the zlibrary adapter updated for layout changes"],"tags":["scraping","empty-result","zlibrary"],"backgroundTag":"empty-scrape-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}