多年来,我一直在使用 Google Docs API 解析一些 Google Docs,我可以使用图片 url 下载图片
https://lh3.googleusercontent.com/[IMAGE_ID]
.
几天后,图片网址已更改为
https://lh3.googleusercontent.com/docs/[IMAGE_ID]
.
在连接到我的 Google 帐户的浏览器中打开 url 可以正确显示图像。
但是我不能再使用API 下载它了
我收到以下错误:
HTTPError: Unable to fetch
https://lh3.googleusercontent.com/docs/AG8NV...
---
Reason: Response code 403 (Forbidden)
---
Fetch details:
{
"attempt": 3,
"method": "GET",
"errorCode": "ERR_NON_2XX_3XX_RESPONSE",
"responseStatusCode": 403,
"responseStatusMessage": "Forbidden",
"requestHeaders": {
"user-agent": "got (https://github.com/sindresorhus/got)",
"accept-encoding": "gzip, deflate, br"
},
"responseHeaders": {
"content-type": "text/html; charset=UTF-8",
"x-content-type-options": "nosniff",
"content-encoding": "gzip",
"date": "Tue, 28 Mar 2023 07:25:20 GMT",
"server": "fife",
"cache-control": "private",
"x-xss-protection": "0",
"alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
"connection": "close",
"transfer-encoding": "chunked"
}
}
我试图在
"authorization": "Bearer [GOOGLE_API_TOKEN]"
中添加一个requestHeaders
,但它不起作用。
前几天有什么变化? 我错过了什么吗?
谢谢