我正在使用以下命令:
wget --no-check-certificate " https://www.googleapis.com/youtube/v3/search?alt=json&q=hello&part=snippet "
我收到 403 Forbidden 错误(这是预期的输出),但也有伴随的服务器响应作为我无法获得的原因。我尝试了各种选项 - 忽略内容长度、提供私有 PEM 证书、设置用户代理等,但仍然无法获得该输出。
但是,使用 curl 时,输出按预期进行。卷曲“ https://www.googleapis.com/youtube/v3/search?alt=json&q=hello&part=snippet ”
wget输出:
--2013-06-07 18:37:13-- https://www.googleapis.com/youtube/v3/search?alt=json&q=hello&part=snippet
Resolving www.googleapis.com (www.googleapis.com)... 74.125.135.95, 2404:6800:4001:c01::5f
Connecting to www.googleapis.com (www.googleapis.com)|74.125.135.95|:443... connected.
WARNING: The certificate of `www.googleapis.com' is not trusted.
WARNING: The certificate of `www.googleapis.com' hasn't got a known issuer.
HTTP request sent, awaiting response... 403 Forbidden
2013-06-07 18:37:14 ERROR 403: Forbidden.
卷曲输出:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
问题是我的许多机器只安装了 wget,所以这对我来说是一个烦人的问题。我几乎可以肯定我错过了一些使 wget 显示输出的选项。如果您有任何想法,我很乐意尝试一下。谢谢。