使用Got库爬取Advent of Code输入数据时遭遇400错误的问题求助
使用Got库爬取Advent of Code输入数据时遭遇400错误的问题求助
我正在尝试爬取Advent of Code的输入数据,为此写了这段代码:
import got from 'got'; (async () =>{ const url = 'https://adventofcode.com/2022/day/1/input' try { const response = await got.get(url); console.log(response.body) console.log(typeof(response.body)) } catch (error) { console.log(error) } })();
但运行后却碰到了错误:HTTPError: Response code 400 (Bad Request)
这段代码请求其他URL时都能正常工作,而且我在浏览器里打开这个输入数据的链接,明明能看到内容。我实在搞不懂问题到底出在哪...
备注:内容来源于stack exchange,提问作者olivier
相关产品推荐
相关产品推荐

