YouTube API analytics - video dimension report for all channel videos - youtube

We are looking to get a report:
https://developers.google.com/youtube/analytics/v1/available_reports
dimensions:country
filter:videoId
for ALL our videos.
In order to do that we getting all our videos
(https://developers.google.com/youtube/v3/docs/search/list)
and looping through each video (we need the breakdown per country for each video)
the question
1. is that the best way to go?
2. we are not getting the private videos since the search does not return them but the analytics page in youtube does take them into consideration so we have a data mismatch.
any help would be appreciated.
Thank you!

To get your videos, you can use channels->list 'with mine=true' and get relatedPlaylists
or
playLists->list with your channelId and 'mine=true'
then
you can go through these videos with playlistItems->list

As of Aug 28, 2014 it is now possible to fetch metrics for up to 200 videos per API call. See information here:
https://developers.google.com/youtube/analytics/revision_history

Related

Get Only Video and not cortos videos

Good morning
I am using the youtube api to get the latest videos from a channel, but I also get the short videos that are like instagram or tiktok reels, is there any way to not get these videos?
I leave the endoint I am using
https://www.googleapis.com/youtube/v3/search?channelId=${channel_id}&part=snippet,id&order=date&maxResults=${totalVideos}&key=${API_KEY_YOUTUBE}
Greetings and thank you
If you check the Search.list method you will notice that it does not have any way of limiting the data that is returned.
You will need to remove these locally.
It may be worth adding a feature request to the issue forumn

YouTube API "playlistItems" does not return all items of the "Uploaded" playlist

I am wondering if anyone knows what could be the cause of this.
On a channel's upload playlist, it states there are 143 videos in the playlist:
When I use the "Playlistitems" API (with paging):
https://developers.google.com/youtube/v3/docs/playlistItems/list
I get 138 items.
I have singled out a specific video that is in the Playlist on YouTube as an example. Video ID Q3UDhRDLbPg:
But when I use the "Playlistitems" API explorer, on the playlist and specify the specific video, I get zero results.
The video is public and was uploaded a few days ago. Some videos that were uploaded on the same day does exist in the results too.
Has anyone seen this problem before and might know the cause of it?
This issue is solved.
As #stvar pointed out, there is some kind of a delay in YouTube's backend, some videos might take longer to be included than others.
All videos are accounted for now, 4 days after the upload time.

How to get list of live video broadcasts using youtube api v3

I'm having an hard time trying to figure out how I can get a list of videos that are live for a given channel. For instance for this channel:
https://www.youtube.com/channel/UC4R8DWoMoI7CAwX8_LjQHig
I can get the videos from the uploads playlist or any playlist without any issue. However, I can't figure out how to get a list of live broadcasts.
Many thanks in advance
Solved by using:
https://developers.google.com/youtube/v3/docs/search/list
There, you can filter by channelId and filter by live only if you add type=video and eventtype=live.
Thanks anyway

YouTube API V3 Get Overall Ratings for Video

In YouTube's V2 API one could obtain a video's rating from the following tag
<gd:rating average="4.254023" numRaters="20509">
I am not finding this information contained within the new V3 api however.
I am using the videos api. I reviewed all of the available properties that can be returned at this location but while I am finding information about "ratings", that information pertains to movie and tv ratings, not how the video was rated.
https://developers.google.com/youtube/v3/docs/videos#properties
Does anyone have experience with this that may know?
From the link you posted, see the statistics object, specifically statistics.likeCount and statistics.dislikeCount.

Get info about a YouTube video

I'm looking to get the title and duration of a YouTube video and display it within my app. I want to do this dynamically since there will be several videos and they will change. I've looked for a URL that provides this information, but I've had no luck. Does anyone know a way to do this?
You need to use the Youtube API, details on how to do this for a single video are here:
https://developers.google.com/youtube/2.0/developers_guide_protocol_video_entries
Here's the URL to get the API data for Friday:
https://gdata.youtube.com/feeds/api/videos/kfVsfOSbJY0?v=2

Resources