我正在尝试使用我的Android应用中的YouTube Data API v3获取视频详细信息。现在我收到以下错误,即使我使用的是API密钥。我该如何解决?
06-19 17:50:58.280: E/There was a service error:(16968): com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
06-19 17:50:58.280: E/There was a service error:(16968): {
06-19 17:50:58.280: E/There was a service error:(16968): "code" : 403,
06-19 17:50:58.280: E/There was a service error:(16968): "errors" : [ {
06-19 17:50:58.280: E/There was a service error:(16968): "domain" : "usageLimits",
06-19 17:50:58.280: E/There was a service error:(16968): "message" : "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
06-19 17:50:58.280: E/There was a service error:(16968): "reason" : "dailyLimitExceededUnreg",
06-19 17:50:58.280: E/There was a service error:(16968): "extendedHelp" : "https://code.google.com/apis/console"
06-19 17:50:58.280: E/There was a service error:(16968): } ],
06-19 17:50:58.280: E/There was a service error:(16968): "message" : "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
06-19 17:50:58.280: E/There was a service error:(16968): }
答案 0 :(得分:11)
尝试在查询中设置api密钥。它可以解决您的问题。 例如:
YouTube.Videos.List listVideosRequest = youtube.videos().list("snippet").setId(videoId);
listVideosRequest.setKey(apiKey);
VideoListResponse listResponse = listVideosRequest.execute();
答案 1 :(得分:0)
此问题似乎是由于Google未验证OAuth同意而引起的。他们有时需要花费很长时间来验证它们,并且如果您的应用程序非常受欢迎,它很快就会达到未认证使用的每日限制。因此,除了与Google信任与安全团队联系以加快验证速度外,您无能为力。