hmjz100/LinkSwift · warning · Error

23018

23018

Error message

提示:<br/>超出游客可获取大小限制<br/>请登录后获取哦~${item?.file_name ? `<br/>文件:${item.file_name}` : ""}

What it means

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.

Source

Thrown at (改)网盘直链下载助手.user.js:8496

			if (selects.every(item => !item.file)) throw new Error("提示:<br/>请打开文件夹后再勾选文件~");
			if (temp.page === "home") {
				const data = [];
				const batchSize = 15;
				let proc = 0;
				selects = selects.filter(item => item.file === true)
				for (let i = 0; i < selects.length; i += batchSize) {
					// 获取当前批次文件
					const batch = selects.slice(i, i + batchSize);
					const fids = batch.map(item => item.fid);
					// 发起请求获取链接
					const 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 });

					if (!res || res.code !== 0 || !res.data) {
						if (res.code == 31001) throw new Error("提示:<br/>请先登录网盘~<br/>代码:" + res.code);
						if (res.code == 23018) {
							const fid = res.message?.match(/\[([a-f0-9]{32})\]/)?.[1];
							const item = batch.find(item => item.fid === fid);
							throw new Error(`提示:<br/>超出游客可获取大小限制<br/>请登录后获取哦~${item?.file_name ? `<br/>文件:${item.file_name}` : ""}`);
						}

						if (res.code || res.message) {
							throw new Error(`提示:<br/>获取链接失败了~<br/>${res.code ? res.code : ""} ${res.message ? res.message : ""}`);
						} else {
							throw new Error("提示:<br/>获取下载链接失败,刷新网页后再试试吧~");
						}
					}

					// 合并响应数据
					if (res.data) {
						data.push(...res.data);
					}
					// 更新处理进度
					proc += batch.length;
					// 更新UI显示
					$doc.find(".loading-popup .loading-title").html(`链接获取中`);
					$doc.find(".loading-popup .swal2-html-container").html(`<div>已获取 ${proc} / ${selects.length} 个链接~</div>`);

View on GitHub (pinned to 417ea5e28a)

Solutions

  1. Log in to Quark netdisk (pan.quark.cn) so the request carries valid cookies
  2. Verify the Cookie header is actually populated (document.cookie non-empty) before calling getLink
  3. Split the selection and download the oversized file via the official web UI instead

Example fix

// before
throw new Error(`提示:<br/>超出游客可获取大小限制<br/>请登录后获取哦~${item?.file_name ? `<br/>文件:${item.file_name}` : ""}`);
// after
if (res.code == 23018) { promptUserToLogin(); return; }
Defensive patterns

Strategy: try-catch

Validate before calling

if (!document.cookie || document.cookie.length < 20) { alert('请先登录夸克网盘'); return; }

Try / catch

try { await getLink(...) } catch (e) { if (String(e.message).includes('23018') || String(e.message).includes('游客')) { showLoginDialog(); } else { throw e; } }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hmjz100/LinkSwift@417ea5e28a (2026-09-02). Data as JSON: /api/errors/74b0796c8fe8c315. Report an issue: GitHub.