其他分享
首页 > 其他分享> > android – 超出未经身份验证的使用的每日限制.继续使用需要注册

android – 超出未经身份验证的使用的每日限制.继续使用需要注册

作者:互联网

我想在我的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): }

解决方法:

尝试在查询中设置api密钥.它可以解决您的问题.
例如:

YouTube.Videos.List listVideosRequest = youtube.videos().list("snippet").setId(videoId);
          listVideosRequest.setKey(apiKey);
          VideoListResponse listResponse = listVideosRequest.execute();

标签:android,youtube-api,youtube-data-api
来源: https://codeday.me/bug/20190716/1477207.html