hmjz100/LinkSwift · error · Error
提示:<br/>页面错误~
Error message
提示:<br/>页面错误~
What it means
Terminal else-branch of the Baidu flow: thrown when `temp.page` is neither 'home'/'main' nor 'share', so the script has no download strategy for the current page. temp.page is set by the script's route/page detection on the Netdisk site.
Source
Thrown at (改)网盘直链下载助手.user.js:6121
files = await this.getFilesUrl(files, token).catch(e => {
if (e instanceof Error) throw e;
throw new Error(e?.message || e || "[百度网盘] 获取文件 URL 失败");
});
} else if (temp.page === "share") {
const shareData = await this.getShareData();
const sign = await base.get(`${config.$baidu.api.getShareSign}&surl=1${shareData.share.url}$bdstoken=${shareData.baidu.token}&logid=${base.encodeBase(shareData.baidu.id)}`);
if (sign?.data?.sign && sign?.data?.timestamp) {
shareData.sign = sign.data.sign;
shareData.timestamp = sign.data.timestamp;
}
files = await this.getShareFilesUrl(files, shareData, token).catch(e => {
if (e instanceof Error) throw e;
throw new Error(e?.message || e || "[百度网盘] 获取分享文件 URL 失败");
});
} else {
throw new Error("提示:<br/>页面错误~");
}
temp.links = [files, {
isFolder: v => v.isdir === 1,
getFileName: v => (v.server_filename || v.filename),
getFileSize: v => v.size,
getFileLink: v => {
if (!v.dlink || !v.dlink.startsWith("http")) return v.dlink;
const url = new URL(v.dlink);
url.searchParams.set("access_token", token);
return url.href;
},
convert: {
aria2: `--header "User-Agent:${config.$baidu.api.ua.downloadLink}"`,
curl: `-A "${config.$baidu.api.ua.downloadLink}"`,
bitcomet: `user_agent=${encodeURIComponent(config.$baidu.api.ua.downloadLink)}`
},
tooltip: config.$baidu.dom
View on GitHub (pinned to 417ea5e28a)
Solutions
- Navigate to the standard file-list page (home/main) or the share page and retry.
- Hard-refresh the page so the script re-runs page detection and sets temp.page correctly.
- Update the userscript to a version supporting the current Netdisk URL scheme.
Defensive patterns
Strategy: validation
Validate before calling
const ok = ['home', 'main', 'share'].includes(temp.page);
if (!ok) { alert('请在网盘文件列表页或分享页使用本脚本'); return; } Type guard
const isSupportedPage = (p) => p === 'home' || p === 'main' || p === 'share';
Try / catch
try { await getLinks(); } catch (e) { if (String(e.message).includes('页面错误')) { location.reload(); return; } throw e; } Prevention
- Use the script only on standard file-list or share pages
- Hard-refresh after SPA navigation so page detection re-runs
- Update the userscript when the Netdisk frontend introduces new routes
When it happens
Trigger: The userscript is invoked on a Baidu Netdisk URL the page-detection logic doesn't classify — e.g. new Netdisk frontend routes, album/note/other special pages, or a redesigned URL scheme that page detection no longer recognizes.
Common situations: Baidu Netdisk redesign introducing new routes the userscript hasn't mapped; opening the download popup from an unusual entry point (mobile web layout, enterprise/new-version Netdisk); page detection state corrupted after SPA navigation without reload.
Related errors
AI-assisted analysis of hmjz100/LinkSwift@417ea5e28a (2026-09-02).
Data as JSON: /api/errors/f425d3b163eda5b0.
Report an issue: GitHub.