0

There's been some changes made to the API since I used it last. This is the way I've successfully used it in the past:

    if($host == 'youtube.com'){
        /* Long YT link.  It will be a GET var. */
        parse_str("$query",$vidArray);
        $ytStatusURL = 'https://www.googleapis.com/youtube/v3/videos?id='.$vidArray['v'].'&key=AIzaS...EQ5rN4czs&part=snippet';
        $json = file_get_contents($ytStatusURL);
        $obj = json_decode($json, true);
        $ytStatus = $obj[pageInfo][totalResults];
        if($ytStatus == '1'){
            $embed_type = 'youtube';
            $vid_string = substr($vidArray['v'], 0, 11);
            $vidKey['a'] = $embed_type;
            $vidKey['b'] = $vid_string;
            return $vidKey;
        }
    }

Which now results in:

 {
   "error": {
     "code": 403,
     "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
     "errors": [
       {
         "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
         "domain": "youtube.quota",
         "reason": "quotaExceeded"
       }
     ]
   }
 }

So I went to check on how many requests have been made:

YouTube Data API v3 Requests: 3 Errors: 100 Latency: 49 Latency, 95%: 63

Either 3 requests is too many or something has changed to cause my api key to start failing and Google's not giving a ton of info on why.

I've followed all the provided links and Googled a bunch but I can't figure out why it's not working. What do I need to do to raise the API key to something more than zero allowed requests?

schwim
  • 9
  • 3
  • Most likely your project has been [disabled due to inactivity](https://stackoverflow.com/a/63211212/8327971). – stvar Dec 30 '20 at 21:03
  • @stvar I would love to mark that as the answer but I don't see a way to. That seems to have been the case. A new project solved my issue. Thanks so much for your help! – schwim Dec 31 '20 at 03:43
  • If you indeed deem my answer solved your issue, you may consider [voting it up](https://stackoverflow.com/help/someone-answers) at the moment you gained a reputation of at least [15 points](https://stackoverflow.com/help/privileges/vote-up) . – stvar Dec 31 '20 at 10:41

0 Answers0