下载图片报错了 #15
-
node ./download.mjs -u 2213526752 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 9 replies
-
看起来是因为这个图片的链接无法访问导致的,我忘了加这个判断😹 你可以手动修改一下 async function download_file(url, file_path) {
const headers = { Referer: referer }
try {
const res = await fetch(url, { headers })
const buffer = await res.arrayBuffer()
writeFileSync(file_path, Buffer.from(buffer))
}
catch (e) {
console.error(`下载失败:${url},原因:${e.cause || e.message}`)
}
} |
Beta Was this translation helpful? Give feedback.
-
我才注意到时间,还真可能是因为太久远的评论是没法直接获取的,要用另一个接口😹😹感谢反馈,下一版我修一下这个问题 |
Beta Was this translation helpful? Give feedback.
-
@HayashiKaori 对了,今天下午的那笔赞赏是你发的吗?❤️先感谢支持了 因为一些限制,目前还是不支持直接点击 index.html 启动,不过再 Windows 可以写一个简单的 .bat 脚本来快速点击启动 node .\server.mjs 之后也会推出桌面app的,将会更方便使用和查看❤️ |
Beta Was this translation helpful? Give feedback.
-
@HayashiKaori 我刚修复了这个 #17 bug,你试一下新版的脚本和 preview 看看,应该没问题了😇 |
Beta Was this translation helpful? Give feedback.
看起来是因为这个图片的链接无法访问导致的,我忘了加这个判断😹
你可以手动修改一下
download.mjs
这个代码中第22行到28行的函数为下面这样。应该就会显示下载失败的原因,而不会直接退出了