wget 被禁止,但可以使用 firefox 下载

wget 被禁止,但可以使用 firefox 下载

我习惯从以下位置下载插件https://www.curseforge.com用我自己的脚本,但现在它不再起作用了。我每次尝试都会得到:

$ LANG=C wget https://www.curseforge.com/wow/addons/classiccastbars/download
--2019-09-23 19:54:13--  https://www.curseforge.com/wow/addons/classiccastbars/download
Resolving www.curseforge.com... 104.19.146.132, 104.19.147.132
Connecting to www.curseforge.com|104.19.146.132|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2019-09-23 19:54:13 ERROR 403: Forbidden.

我尝试使用用户代理等...但没有成功。

编辑:按照@alessiosavi的建议,在chrome中,使用“复制为curl”,这是我得到的(我可以看到2个get请求):

1)

curl 'https://geoservice.curse.com/geo/get' -X OPTIONS -H 'Sec-Fetch-Mode: no-cors' -H 'Access-Control-Request-Method: GET' -H 'Origin: https://www.curseforge.com' -H 'Referer: https://www.curseforge.com/wow/addons/classiccastbars' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'Access-Control-Request-Headers: content-type' --compressed

2)

curl 'https://geoservice.curse.com/geo/get' -H 'Sec-Fetch-Mode: cors' -H 'Referer: https://www.curseforge.com/wow/addons/classiccastbars' -H 'Origin: https://www.curseforge.com' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'Content-type: application/json' --compressed

或者可能是这个:

curl 'https://www.curseforge.com/wow/addons/classiccastbars/' -H 'authority: www.curseforge.com' -H 'cache-control: max-age=0' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'sec-fetch-mode: navigate' -H 'sec-fetch-user: ?1' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3' -H 'sec-fetch-site: none' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7' -H 'cookie: __cfduid=d6db4b9c10ef925c90eb1e08149a96a201569420606; Unique_ID_v2=389cbe9684ea464b9e6616e7cbe84b57; ResponsiveSwitch.DesktopMode=1; _ga=GA1.2.1639390131.1569420607; __utmz=94490894.1569420608.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _gid=GA1.2.465525518.1569862527; cdmgeo=mq; __cf_bm=b234703f5bd6f21761c0002828ff592ccea25d53-1569873659-1800-AeS9BMnquwJXGm3hqxR7oFz8yIgB6GrqsaNUQWNeTm/dwySd97EpXaWe8fs/PM84TblHp5/hGprjBm6gPR9cPVs=; __utma=94490894.1639390131.1569420607.1569862527.1569873663.3; __utmc=94490894; __utmt=1; __utmt_b=1; __utmb=94490894.2.10.1569873663; AWSALB=HqlxzmKRURpTjWDSKP5YL4yg+YY+qh/dSgTQJ82Za+TjPHmufaPMLuwicjEayRNj6PEAv3oX/qXgqRO1VfopMN9crXu20eUJ+CHykVh2xXodkqFLI6A7U7lizGeP' --compressed

答案1

通过 F11 键打开开发人员选项卡,然后进入该network选项卡。如果您在打开开发人员选项卡的情况下进行 http 调用,您将看到(通常在 XHR http 调用下)您的请求。您现在可以按right click请求并按copy as cURL

笔记:

一定要打复制为 cURL代替全部复制为 cURL

现在,您可以将请求粘贴到文本编辑器中,并验证浏览器发送的 cookie 以验证请求。尝试包含(至少)所有饼干请求中列出。

相关内容