I have been trying to get the video list of our youtube channel and advance statistics like avg view duration, subscribers gained, watch time, etc.
These statistics do exist in Youtube analytics Web GUI. But I could not find how I can implement that per video via API.
I have tried youtubeAnalytics.reports.query API - but unable to get the advanced statistics.
with these parameters
ids : channel==MINE
filter = video==
startdate: 2019-02-15
enddate: 2019-02-20
metrics likes- dislikes avgviewDuration,
dimension: day
and other try with
dimension day,video
I am getting null data or query not implemented.
Related
I am trying to get videos of a particular channel (like :- Luis Fonsi) in highest views order. And I am passing order parameter to sort the response by viewCount
like :-
order=viewCount
URL :-
https://www.googleapis.com/youtube/v3/search?key=[MY-API-KEY]&channelId=UCxoq-PAQeAdk_zyg8YS0JqA&part=snippet,id&order=viewCount&maxResults=20000
When I try to run it then It is not sorting as I expected. I was expecting first song would be Despacito But It got another one which definitely don't have the highest views.
As mentioned in Youtube-API Documentation in search section.
viewCount – Resources are sorted from highest to lowest number of views.
It is not working like this.
I have tried many times but it is still not working.
Any help would be much Appreciated.
YouTube Data API v3 is broken on some aspects, if I were you, I would just retrieve all videos from the given YouTube channel and then sort them.
To do so:
Get the channel's uploads playlist id by using Channels: list with part=contentDetails.
Get the channel's videos by using PlaylistItems:
list
with playlistId=UPLOADS_PLAYLIST_ID (replacing
UPLOADS_PLAYLIST_ID with the one you just obtained).
Get each
video's view count by using part=statistics with Videos:
list.
Im new to yt api and i was wondering how can i get for example top 50 channels by subscriber count with defined date, or in interval like 2018-2019?
I am trying to get video metrics for each video under my channel using Java SDK.
videoMetrics = analytics.reports()
.query("channel==" + channelId, video_start_date, video_end_date, "views,comments,likes,dislikes,estimatedMinutesWatched")
.setDimensions("day")
.setSort("-estimatedMinutesWatched")
.setFilters("video==" + videoId)
.setFilters("country==US")
.execute();
This request not providing the metrics for each video on a particular day. Can anyone suggest the issue and solution in the code.
You're looking for reports.query.
The YouTube Analytics
API's
reports.query method lets you retrieve many different Analytics
reports. Each request uses query parameters to specify a channel ID or
content owner, a start date, an end date, and at least one metric. You
can also provide additional query parameters, such as dimensions,
filters, or sorting instructions.
Metrics are individual measurements of user activity, such as video
views or ratings (likes and dislikes). Dimensions are common criteria
that are used to aggregate data, such as the date on which the user
activity occurred or the country where the users were located. Filters
are dimension values that specify the data that will be retrieved. For
example, you could retrieve data for a specific country, a specific
video, or a group of videos.
I'm trying to get "ALL" game live streams from youtube using API.
The way I first used is through "Search.list" with parameters: https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet&eventType=live&maxResults=50&type=video&videoCategoryId=20. But in this way when I try to iterate results using PageToken, I can only get around 100 results while in the API response I can see "totalResults" is around 2000. Then I came into this topic and realized that "Search.list" is actually kind of "ranking" algorithm instead of "fetch all data from DB", which means "totalResults" is just an estimated number of results.
Then I came to use "liveBroadcasts.list" but it returns no results: https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.liveBroadcasts.list?part=id&broadcastStatus=active&maxResults=50&_h=8&
And for other APIs, they either need channelId or other ids.
Is there any way to get all game live streams regardless of any ids?
According to Youtube Category ID list, Gaming resides on number 20 category. In case you want to try a different category in the future, instead of videoCategoryId=20, you can try videoCategoryId=31 - that's for Anime/Animation.
Try to run this on your browser to get all live streams:
https://www.googleapis.com/youtube/v3/search?part=snippet&eventType=live&type=video&videoCategoryId=20®ionCode=US&maxResults=50&key=SERVER_API_KEY_HERE
When using the API for retrieving aggregated metrics for the channel's content the report returns a single row of data that contains totals for each requested metric during the specified date
range.
Here's an API Example link.
Sometimes not even account information is received; the object rows is not present in the response but only columnHeaders, even though the account has the appropriate fields populated (I can see it on the profile available on youtube).
I have made the same observations as jay. Somehow some metrics returned no result rows. But for me it turned out that those missing rows were also not available in youtube's Analytics integration.
As you can see, all "Interaktionen (Interactions)" have 0 values, but the "Geteilte Inhalte (shares)" column differs from the rest. It has no values attached. If you click on the metric you get the following notification
It says: "There is no data available at the moment, chose a diffrent time range or wait some more days".
So for me the API data was always corresponding with youtube's analytics integration.