{"record":{"id":"74b0796c8fe8c315","repo":"hmjz100/LinkSwift","slug":"23018","errorCode":"23018","errorMessage":"提示：<br/>超出游客可获取大小限制<br/>请登录后获取哦~${item?.file_name ? `<br/>文件：${item.file_name}` : \"\"}","messagePattern":"提示：<br/>超出游客可获取大小限制<br/>请登录后获取哦~(.+?)` : \"\"\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"（改）网盘直链下载助手.user.js","lineNumber":8496,"sourceCode":"\t\t\tif (selects.every(item => !item.file)) throw new Error(\"提示：<br/>请打开文件夹后再勾选文件~\");\r\n\t\t\tif (temp.page === \"home\") {\r\n\t\t\t\tconst data = [];\r\n\t\t\t\tconst batchSize = 15;\r\n\t\t\t\tlet proc = 0;\r\n\t\t\t\tselects = selects.filter(item => item.file === true)\r\n\t\t\t\tfor (let i = 0; i < selects.length; i += batchSize) {\r\n\t\t\t\t\t// 获取当前批次文件\r\n\t\t\t\t\tconst batch = selects.slice(i, i + batchSize);\r\n\t\t\t\t\tconst fids = batch.map(item => item.fid);\r\n\t\t\t\t\t// 发起请求获取链接\r\n\t\t\t\t\tconst res = await base.post(config.$quark.api.getLink, { \"fids\": fids }, { \"Content-Type\": \"application/json\", \"Cookie\": String(document.cookie), \"User-Agent\": config.$quark.api.ua.downloadLink });\r\n\r\n\t\t\t\t\tif (!res || res.code !== 0 || !res.data) {\r\n\t\t\t\t\t\tif (res.code == 31001) throw new Error(\"提示：<br/>请先登录网盘~<br/>代码：\" + res.code);\r\n\t\t\t\t\t\tif (res.code == 23018) {\r\n\t\t\t\t\t\t\tconst fid = res.message?.match(/\\[([a-f0-9]{32})\\]/)?.[1];\r\n\t\t\t\t\t\t\tconst item = batch.find(item => item.fid === fid);\r\n\t\t\t\t\t\t\tthrow new Error(`提示：<br/>超出游客可获取大小限制<br/>请登录后获取哦~${item?.file_name ? `<br/>文件：${item.file_name}` : \"\"}`);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif (res.code || res.message) {\r\n\t\t\t\t\t\t\tthrow new Error(`提示：<br/>获取链接失败了~<br/>${res.code ? res.code : \"\"} ${res.message ? res.message : \"\"}`);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthrow new Error(\"提示：<br/>获取下载链接失败，刷新网页后再试试吧~\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// 合并响应数据\r\n\t\t\t\t\tif (res.data) {\r\n\t\t\t\t\t\tdata.push(...res.data);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// 更新处理进度\r\n\t\t\t\t\tproc += batch.length;\r\n\t\t\t\t\t// 更新UI显示\r\n\t\t\t\t\t$doc.find(\".loading-popup .loading-title\").html(`链接获取中`);\r\n\t\t\t\t\t$doc.find(\".loading-popup .swal2-html-container\").html(`<div>已获取 ${proc} / ${selects.length} 个链接~</div>`);\r","sourceCodeStart":8478,"sourceCodeEnd":8514,"githubUrl":"https://github.com/hmjz100/LinkSwift/blob/417ea5e28a3e1a90339710e17356e9fd22b8a34b/（改）网盘直链下载助手.user.js#L8478-L8514","documentation":"Quark netdisk link fetch failed with API code 23018, meaning the file exceeds the size quota allowed for guest (not-logged-in) access. The script inspects the API error message for a 32-hex fid, looks up the matching selected item, and rethrows a user-facing error naming the file. It exists to translate a raw Quark API failure into an actionable login prompt.","triggerScenarios":"POSTing to config.$quark.api.getLink (share page flow) while not logged in, with a batch (up to 15 fids) containing a file larger than the guest size limit; Quark returns code 23018 whose message contains the offending fid in [hex32] form.","commonSituations":"Anonymous visitors of a share page trying to fetch a direct link for a large file; cookies expired/cleared so the request is treated as guest even though the user thinks they are logged in.","solutions":["Log in to Quark netdisk (pan.quark.cn) so the request carries valid cookies","Verify the Cookie header is actually populated (document.cookie non-empty) before calling getLink","Split the selection and download the oversized file via the official web UI instead"],"exampleFix":"// before\nthrow new Error(`提示：<br/>超出游客可获取大小限制<br/>请登录后获取哦~${item?.file_name ? `<br/>文件：${item.file_name}` : \"\"}`);\n// after\nif (res.code == 23018) { promptUserToLogin(); return; }","handlingStrategy":"try-catch","validationCode":"if (!document.cookie || document.cookie.length < 20) { alert('请先登录夸克网盘'); return; }","typeGuard":null,"tryCatchPattern":"try { await getLink(...) } catch (e) { if (String(e.message).includes('23018') || String(e.message).includes('游客')) { showLoginDialog(); } else { throw e; } }","preventionTips":["Log in to pan.quark.cn before using the export feature","Re-check login state after clearing cookies or using incognito","Watch for the file name in the error to identify oversized files"],"tags":["userscript","quark-netdisk","auth-required","guest-quota"],"backgroundTag":"guest-download-size-limit","analyzedSha":"417ea5e28a3e1a90339710e17356e9fd22b8a34b","analyzedAt":"2026-09-02T18:13:32.837Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}