puppeteer 爬取一个做了反爬的网站 已经返回'content-disposition': 'attachment; filename=xx.zip 但还是无法下载文件

232 天前
 zhouyin
```javascript
{
'cache-control': 'no-store, no-cache, must-revalidate',
connection: 'Keep-Alive',
'content-disposition': 'attachment; filename="xxxx.zip"',
'content-length': '21147482',
'content-type': 'application/zip',
date: 'Sun, 02 Feb 2025 04:09:28 GMT',
expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
'keep-alive': 'timeout=5, max=98',
pragma: 'no-cache',
server: 'Apache/2.4.52 (Ubuntu)',
'set-cookie': 'PHPSESSID=94fvcskn745lsq6tb751gnrpov; expires=Sun, 02-Feb-2025 04:39:28 GMT; Max-Age=1800; path=/',
'x-php-sess-user': 'dddddd'
}

```
本来能下载的 前几天网站好像升级了
1201 次点击
所在节点    问与答
3 条回复
zhouyin
232 天前
在 win11 上随 node 启动的 chrome 看图
https://imgur.la/image/imgapp.xF2jF

puppeteer 是下面这样启动的

```javascript

const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth')
puppeteer.use(StealthPlugin())



const browser = await puppeteer.launch({
headless: false,
args: ['--no-sandbox', '--disable-setuid-sandbox', '-–disable-gpu',
'-–disable-dev-shm-usage', '-–no-first-run', '-–no-zygote',
'-–single-process'],
});
```


package.json 版本:
```javascript

"dependencies": {
"chrome-har": "^0.7.1",
"chrome-launcher": "^0.10.5",
"puppeteer": "^24.1.1",
"puppeteer-extra": "^3.3.6",
"puppeteer-extra-plugin-stealth": "^2.11.2"
}
```
follower
232 天前
把手动点击下载的响应头也发出来看下?
zhouyin
232 天前
@follower
已解决 原来是下载目录设置问题

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1108594

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX