hmjz100/LinkSwift · error · Error
[光鸭云盘] 获取文件下载 URL 失败
Error message
[光鸭云盘] 获取文件下载 URL 失败
What it means
Fallback wrapper in the 'home' page branch of 光鸭云盘 getLink(): when the Promise.all over the batch queue rejects, any non-Error rejection is re-thrown as this generic '[光鸭云盘] 获取文件下载 URL 失败' message. It masks the per-file failure reason because the original thrown value was not an Error instance.
Source
Thrown at (改)网盘直链下载助手.user.js:8120
const batchSize = 15;
let proc = 0;
$doc.find(".loading-popup .loading-title").html(`链接获取中`);
$doc.find(".loading-popup .swal2-html-container").html(`<div>正在获取文件对应的下载链接~</div>`);
for (let i = 0; i < selects.length; i += batchSize) {
const batch = selects.slice(i, i + batchSize);
const queue = [];
batch.forEach((item, localIndex) => {
const globalIndex = i + localIndex;
queue.push(this.getFileUrl(item, globalIndex, token)
.then(val => {
proc++;
$doc.find(".loading-popup .swal2-html-container").html(`<div>已获取 ${proc} / ${selects.length} 个链接~</div>`);
return val;
}));
});
const res = await Promise.all(queue).catch(e => {
if (e instanceof Error) throw e;
throw new Error(e?.message || e || "[光鸭云盘] 获取文件下载 URL 失败");
});
res.forEach(val => {
selects[val.index].downloadUrl = val.downloadUrl;
});
await base.sleep(1000);
}
} else if (temp.page === "share") {
const token = this.getToken();
const shareToken = await this.getShareToken(false, token).catch(e => {
if (e instanceof Error) throw e;
throw new Error(e?.message || e || "[光鸭云盘] 获取分享令牌失败");
});
const batchSize = 15;
let proc = 0;
$doc.find(".loading-popup .loading-title").html(`链接获取中`);
$doc.find(".loading-popup .swal2-html-container").html(`<div>正在获取文件对应的下载链接~</div>`);
for (let i = 0; i < selects.length; i += batchSize) {
const batch = selects.slice(i, i + batchSize);
View on GitHub (pinned to 417ea5e28a)
Solutions
- Retry the link fetch — transient batch failures often clear on a second attempt.
- Reduce selection size / retry in smaller batches to isolate which file fails.
- Check browser console/network for the failing per-file API call and its status code.
- Ensure you are logged in if the failing task needed credentials.
Example fix
// before
throw new Error(e?.message || e || "[光鸭云盘] 获取文件下载 URL 失败");
// after
const reason = e instanceof Error ? e.message : (typeof e === 'string' ? e : JSON.stringify(e));
throw new Error(`[光鸭云盘] 获取文件下载 URL 失败:${reason}`); Defensive patterns
Strategy: retry
Type guard
const hasErrorDetail = e => e instanceof Error || e?.message || typeof e === 'string';
Try / catch
try { await driver.getLink(); } catch (e) { if (String(e.message).includes('获取文件下载 URL 失败')) { await sleep(1500); return driver.getLink(); } throw e; } Prevention
- Retry with a smaller selection to isolate the failing file
- Keep the browser console open to see the real per-file failure
- Ensure a stable network and an active login session
When it happens
Trigger: One of the batched per-file URL tasks rejected with a non-Error value (plain string, object, or undefined) — e.g. an inner .catch(() => Promise.reject('...')) or a rejected fetch handled by rejecting with a raw message.
Common situations: Backend per-file API returned an unexpected shape and the batch task rejected with a plain object; a batch task threw a string; rate limiting made a task reject without an Error.
Related errors
- [中国移动云盘] 获取文件 URL 失败
- [天翼云盘] 获取文件 URL 失败
- 提示:<br/>请先登录网盘后再刷新页面呢~
- GreaseMonkey 兼容 XMLHttpRequest 不可用。
- [百度网盘] 获取令牌失败
AI-assisted analysis of hmjz100/LinkSwift@417ea5e28a (2026-09-02).
Data as JSON: /api/errors/77998c715bb00c92.
Report an issue: GitHub.