Daily Limit for Unauthenticated Use Exceeded. Cont

2019-07-02 13:14发布

问题:

I am trying to fetch video details using YouTube Data API v3 in my android app. Now I am getting the following error even though I am using an API Key. How can I resolve it?

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): }

回答1:

Try to set api key on your query. It may resolve your problem. ex:

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