Having issues with Youtube Data API key failing

Hello, everyone!

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:

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?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.