Youtube Data API search.list malfunctioning for live streams - youtube-api

We are finding that the YouTube API is intermittently misreporting zero live streams within channel searches when specifically asking for eventType=live. It seems the timing for this issue is random but, for example, the following API call will either return everything or nothing, without changing any parameters. Our quota is fine. The channel (and many others we have tried) have multiple live webcam streams on 24/7 so they are not all going on and offline from one second to the next.
This is the API call (with API key removed):
https://youtube.googleapis.com/youtube/v3/search?part=snippet&eventType=live&type=video&channelId=UCY6XpD-K4mNk_C97pMiMJ8A&maxResults=50&key=(removed).
It’ll work sometimes, and not other times. At any attempt there are many live streams in that channel.
The “nothing” response is as follows:
{
"kind": "youtube#searchListResponse",
"etag": "LgldeqxlASUfgtUiqLulF4E6Tcw",
"regionCode": "GB",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": []
}
Which is wrong at the time of the request.
If we remove eventType=live then when this issue is occurring we notice the live streams‘s liveBroadcastContent parameter are all marked with none instead of live.
This appears to be an API bug and it’s hindering development of our tool. Please help!
Pat

Related

YouTube api returns empty results where video exists

Using the youtube API, I get no results for either channels list, search, ... for a channel where there is some content.
There is no error returned, just an empty set. No channels, no video, nothing either in the API explorer or through my code.
Everything was working correctly up until a few days/weeks (hard to tell when since I had no errors)
curl -v 'https://www.googleapis.com/youtube/v3/search?key=[api_key]&channelId=UCKTgGP9lrL5Yjs4f8WuI1Vw&part=snippet,id&order=date&maxResults=20'
is the query I used but I tried to get the uploads channel id as some answers here advised but the channels/list endpoint is empty too. I checked the documentation and I couldn't find anything wrong with my query.
This is the answer I currently get:
{
"kind": "youtube#searchListResponse",
"etag": "\"ksCrgYQhtFrXgbHAhi9Fo5t0C2I/nrqzXB-_ht29Bt6u-f7_lLyFcCw\"",
"regionCode": "BE",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 20
},
"items": []
}
and you can see here https://www.youtube.com/channel/UCKTgGP9lrL5Yjs4f8WuI1Vw/videos that it's not empty.
Try to add type=video as param, it seems working :)

YouTube Data API - channel IDs changed overnight at 28 of February

We are handling several YT channels for our customers via the Data API. Since 28 of February, we are getting strange responses on https://developers.google.com/youtube/v3/docs/channels/list#part and https://developers.google.com/youtube/v3/docs/search/list endpoints. In most cases, the response contains an empty items list but returns with 200. It looks like the access token is fine (otherwise it would return with 403 or something similar) but it's not connected to any channel.
E.g.:
https://www.googleapis.com/youtube/v3/channels?id=&part=snippet%2CcontentDetails%2Cstatistics
returns with:
{
"items": [],
"kind": "youtube#channelListResponse",
"etag": <etag>,
"pageInfo": {
"resultsPerPage": 0,
"totalResults": 0
}
}
We have noticed a strange behavior in some cases when calling the same endpoint with "mine=true". It gave back channel details in the items list but the ID of the channel in the response is different than the ID we store for the same channel. We tried to call the endpoint with the ID from the response and the access token we store and it worked fine. The "publishedAt" section of the response shows that this channel has been created at "2017-05-19T18:59:45.000Z" so it's not a new one and according to our logs before 2020-02-28 it worked fine with our ID.
These circumstances make me think the ID of several channels has just changed and that's why we are getting these strange or empty responses.
Has anybody else experienced the same issues?
Please note that I'm not talking about items[] in invideoPromotion, I know that part is deprecated.

How can I figure the youtube video out whether it is private or not existed?

When I use video.list with API_KEY (not authenticated with OAuth) for a private or not existed (maybe deleted or invalid video id) video, I can't know status of the video at all. It just only gives empty items.
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=foo&key={API_KEY}
{
"kind": "youtube#videoListResponse",
"etag": "\"q5k97EMVGxODeKcDgp8gnMu79wM/Rk41fm-2TD0VG1yv0-bkUvcBi9s\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": [
]
}
The document is telling me if I can't find video resource, you will get an error. But, it doesn't happen to me whatever id is. I've found out the solution in similar situation for Playlist case before, it was possible to catch the information to use playlistItem.list indirectly. However, in this situation, how can I find out the status?
Tried it out myself. Returned with a response status of 200, message null and an empty JSON item object too. It's weird that this is handled for playlistitems.list but not for video.list. Google Developers might have missed out on handling these kinds of scenarios for video.list. Guess there's really no way of telling if a video is private or if it even did exist at all using the Youtube Data API.
What I thought of is to try to make requests directly to the Youtube URL using the url
https://www.youtube.com/watch?v=<id>
then just check at the contents of <div class =”content”>
You can try to do this by using XPath or any similar XML traversing tools.

YouTube Streaming API returns no results

I'm using Google's YouTube API Explorer (alternate) to look up information on streaming broadcasts.
No matter what I put into the various "Filter" fields (id, broadcastStatus, mine), I always get back something like
{
"kind": "youtube#liveBroadcastListResponse",
"etag": "\"sGDdEsjSJ_SnACpEvVQ6MtTzkrI/1a_a-Wfcf01HR1raH5I2Na5kI1o\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
},
"items": [
]
} // (The etag changes each time)
This seems ridiculous, considering that someone somewhere is demonstrably streaming.
It makes sense that mine=true doesn't return any results because I've never broadcasted anything, but broadcastStatus=all should give me something.
What is going wrong?
I know this is an old question but I've encountered the same issue yesterday and it seems that I'm missing the broadcastType parameter.
Acceptable values are:
all – Return all broadcasts.
event – Return only scheduled event broadcasts.
persistent – Return only persistent broadcasts.
https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/list
So my final request looks like:
https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id&mine=true&broadcastType=all
In response to a bug report issued by DaImTo, Google has responded by telling us that we are not permitted to see live broadcasts by other users.
ma…#google.com <ma…#google.com> #3 Jun 25, 2018 07:11 PM
Status: Won't Fix (Intended Behavior)
The Live Streaming API only permits you to list the live broadcasts of the authenticated user.
However, an answer to a similar question can retrieve currently streaming events by parsing the href attribute of <link rel="canonical" /> on the channel page.

Youtube Data API v3 playlistitems endpoint returning empty items array

I'm using the playlistItems endpoint to get a list of videos that have been uploaded by an account. The response shows 1 as totalResults, which is expected, but the items array is empty, which is not. It's not clear to me what's going on, since the video is public and has views on it.
I'm not seeing this issue pulling uploads from other accounts, so I'm wondering if it's a caching issue on the YT side, or some setting we need to enable on our account? I'm not able to find any documentation that would explain what's happening here.
The endpoint I'm hitting is https://www.googleapis.com/youtube/v3/playlistItems?key=<api key>&playlistId=UUjQYaIbYceXNNdC63dQ9aTg&maxResults=10&part=snippet, and the full response I'm receiving is:
{
"kind": "youtube#playlistItemListResponse",
"etag": "\"PSjn-HSKiX6orvNhGZvglLI2lvk/eJKYM5x3WquVgzqxNc7NMRuOS4o\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 10
},
"items": []
}
The item is now showing up, so it looks to just take some time before the API reflects what's been uploaded.

Resources