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?
Related
So I've just started to use the Youtube Data API to get comments from youtube videos. My program has been working until I tried to use the next page token to get more comments. So it first calls the normal URL without the &pageToken=***and then the next time it loops back it calls it with that but returns an error
{
"error": {
"errors": [
{
"domain": "youtube.parameter",
"reason": "invalidPageToken",
"message": "The request specifies an invalid page token.",
"locationType": "parameter",
"location": "pageToken"
}
],
"code": 400,
"message": "The request specifies an invalid page token."
}
}
My program, when calling the first time would get the key returned and save it in a variable for the next time it calls the new url. Yes, I have verified that my variable holds a key. Any help would be greatly appreciated! Thanks in advance :D
You forget playlistId it's required , example :
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=3&playlistId=PLw6Y5u47CYq47oDw63bMqkq06fjuoK_GJ&pageToken=EAAaBlBUOkNBTQ&key=['api_key']&nextPageToken=EAAaBlBUOkNBTQ
take a look on api documentation
I developed an integration with Youtube two years ago to retrieve video url's. But last month it started to fail.
My process is:
Using Channels.list and passing UserId we obtain a list of Uploads from: channel.ContentDetails.RelatedPlaylists.Uploads
With this id we use the method: PlayListItems.List passing uploads id in playlistRequest.PlaylistId. We receive a list of playlistItems.
This two calls are working fine. We are obtaining a list of videos.
But when we try to retrieve a video to get the URL we are receiving a 500 error.
PlayListItems.List
Id: VVV0MUNhMG5rWDdVa3J0REFNVk5jTEhRLnFJMURfb0dhYXBj
Part: Snippet
Response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}
Example Calls:
Channels.list:
id: UCt1Ca0nkX7UkrtDAMVNcLHQ
Part: ContentDetails
PlayListItems.List:
Part = snippet
PlayListId: UUt1Ca0nkX7UkrtDAMVNcLHQ
PlayListItems.List:
Part: Snippet
Id: VVV0MUNhMG5rWDdVa3J0REFNVk5jTEhRLnFJMURfb0dhYXBj
any idea why is now failing?
I try list messages from LiveChat of YouTube. Request:
GET https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId=Qfad59EnhUA&part=snippet&key={YOUR_API_KEY}
Response:
404 Not Found
{
"error": {
"errors": [
{
"domain": "youtube.liveChat",
"reason": "liveChatNotFound",
"message": "The live chat that you are trying to retrieve cannot be found. Check the value of the requests <code>liveChatId</code> parameter to ensure that it is correct."
}
],
"code": 404,
"message": "The live chat that you are trying to retrieve cannot be found. Check the value of the requests <code>liveChatId</code> parameter to ensure that it is correct."
}
}
Pages https://www.youtube.com/live_chat?is_popout=1&v=Qfad59EnhUA and
https://www.youtube.com/watch?v=Qfad59EnhUA exist.
What's wrong?
i decide this problem. liveChatId can be get from broadcast for python:
print '%s' % (broadcast['snippet']['liveChatId'])
I'm trying to get player info for authenticated user, it successful for the first request, but then fails later.
{
"error": {
"code": 500,
"message": null
}
}
I already turning on OAuth 2.0, set the playerId to 'me', but it returns 500.
Is there something wrong? Is there any limit requests for this one? Is anything missing?
Thanks,
I have problem with the ESPN API:
I have an API key, and sent a query to the address http://api.espn.com/v1/sports/news/1581816?region=GB, which included my API key in the parameters.
I received 403 forbidden response: with this JSON
{
"status": "error",
"code": 403,
"message" : "Account Inactive"
}
I am looking at http://developer.espn.com/docs/headlines#using-the-api and at the last line it says that i can make a GET request to this url and it should work, but it doesn't.
How can I receive a valid response from the ESPN servers?
I just test it and it works fine. That means your key is invalid, or you are not including it. Replace below and it will work.
http://api.espn.com/v1/sports/news/1581816?region=GB&apikey=<yourKey>
--
{
timestamp: "2013-10-13T15:33:49Z",
resultsOffset: 0,
status: "success",
resultsLimit: 10,
resultsCount: 1,
headlines: [
{ ... }
]
}