Youtube Reporting API returns video data but Youtube Data API does not for specific channel - youtube-api

I have this issue where a specific channel is not returning any videos on the Data-API (see response from API below):
{
"kind": "youtube#videoListResponse",
"etag": "YIUPVpqNjppyCWOZfL-19bLb7uk",
"items": [],
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
}
}
In the meanwhile I can see data on its videos on Reporting API, both for Combined A2 and Basic A2 report types, like below (anonymized):
date,channel_id,video_id,live_or_on_demand,subscribed_status,country_code,views,comments,likes,dislikes,shares,watch_time_minutes,average_view_duration_seconds,average_view_duration_percentage,annotation_impressions,annotation_clickable_impressions,annotation_clicks,annotation_click_through_rate,annotation_closable_impressions,annotation_closes,annotation_close_rate,card_teaser_impressions,card_teaser_clicks,card_teaser_click_rate,card_impressions,card_clicks,card_click_rate,subscribers_gained,subscribers_lost,videos_added_to_playlists,videos_removed_from_playlists,red_views,red_watch_time_minutes
20221018,CHANNEL_ID,VIDEO_ID,on_demand,not_subscribed,FR,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
The request done to Data API has the following parts specified: snippet,contentDetails,statistics,id,topicDetails (independent of parts the request yields an empty answer as well)
Channel ID: UCs5DLbzGZJ559lKPP2pEWCw
Playlist ID: UUs5DLbzGZJ559lKPP2pEWCw
Tried calling Data API with third party token, with channel's token, checked on Reporting API (there is data there but not on Data API).
I expected: that videos are listed in Data API's PlaylistItems.list edge.

Related

Why does YouTube Data API search often find 0 results while a normal YouTube website search yields many results?

We are using YouTube Data API to show product review videos on product pages of our price comparison website. We basically grab a product title and append "review" to it. The problem is that very often we do not get any results from the API, while a normal YouTube website search yields many results.
For example, the following request, when searching for "Reiskussen Intex Downy Opblaasbaar Blauw review" (using the Try this API form in the docs) does not give us any results:
https://www.googleapis.com/youtube/v3/search?part=snippet&q=Reiskussen%20Intex%20Downy%20Opblaasbaar%20Blauw%20review&key=[YOUR_API_KEY]
This is the JSON response:
{
"kind": "youtube#searchListResponse",
"etag": "z1qySaHHjn5TA8Vggil4LrmXKdc",
"regionCode": "NL",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 5
},
"items": []
}
When we search on Youtube, we get several (relevant) results:
Why does the YouTube website find results and our API call does not? Is there any way to have the API find the same results or any result at all?

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.

YouTube Data API channels list returning no results for valid Channel ID

I'm attempting to access https://www.youtube.com/channel/UC7LoiySz7-FcGgZCKBq_2vQ via the YouTube Data API v3 however am not able to load channel by id:
https://content.googleapis.com/youtube/v3/channels?part=snippet&id=UC7LoiySz7-FcGgZCKBq_2vQ&key=<omitted>
{
"kind": "youtube#channelListResponse",
"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/Rk41fm-2TD0VG1yv0-bkUvcBi9s\"",
"pageInfo": {
"totalResults": 0,
"resultsPerPage": 0
},
"items": []
}
other channels that this same error occurs for:
https://www.youtube.com/channel/UCzwNZaQ2qyZw0n3xOSNoXaQ
https://www.youtube.com/channel/UC0iFwqagVPP6pXiDwYU170g
Your channels are of type hidden. This is the expected outcome. Unhide it and work your way from there.
Delete or hide your YouTube channel:
You can hide content from your YouTube channel and choose to re-enable
it later. When you hide content, your channel name, videos, likes,
subscriptions, and subscribers will be made private.
All your comments and replies will be permanently deleted. Your
account data on other Google properties will not be removed.
One more time YouTube Data API v3 doesn't provide a basic feature.
I recommend you to try out my open-source YouTube operational API. Indeed by fetching https://yt.lemnoslife.com/channels?part=status&id=CHANNEL_ID, you will get the YouTube channel status message you are looking for in item["status"].
For instance with this channel id UC7LoiySz7-FcGgZCKBq_2vQ you would get:
{
"kind": "youtube#channelListResponse",
"etag": "NotImplemented",
"items": [
{
"kind": "youtube#channel",
"etag": "NotImplemented",
"id": "UC7LoiySz7-FcGgZCKBq_2vQ",
"status": "This channel is not available."
}
]
}
For a suspended YouTube channel such as UCF_UozwQBJY4WHZ7yilYkjA, you would get for status: "This account has been terminated due to multiple or severe violations of YouTube's policy on nudity or sexual content.".
For a normal channel, such as UC4QobU6STFB0P71PMvOGN5A, you would get for status: null.

YouTube API - Get live streams by channelIds

How do you query multiple channels to see if they are streaming at that moment?
I tried to add multiple channelIds in this query:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId={channels_seperated_by_comma_and_http_query}&eventType=live&type=video&key={my_key}
That only gives the result of the first key
You can use Channels:list, which returns a collection of more than one channel.
HTTP request
GET https://www.googleapis.com/youtube/v3/channels
From the parameter part, it will give you contentDetails part=contentDetails
Response
If successful, this method returns a response body with the following structure:
{
"kind": "youtube#channelListResponse",
"etag": etag,
"nextPageToken": string,
"prevPageToken": string,
"pageInfo": {
"totalResults": integer,
"resultsPerPage": integer
},
"items": [
channel Resource
]
}
Based from Ibrahim Ulukaya, you can not add comma separated channels here. Either you can leave it blank to search all channels, or you can have a request per each channel and merge results. There is no multichannel search API.

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