How to get watch later playlist details after September 12th? - youtube

Today, on YouTube's revision history page it is stated that
The channel resource's contentDetails.relatedPlaylists.watchHistory
and contentDetails.relatedPlaylists.watchLater properties are only
visible to an authorized user retrieving data about the user's own
channel. After September 12, 2016, the
contentDetails.relatedPlaylists.watchHistory will return a value of HL
and the contentDetails.relatedPlaylists.watchLater property will
return a value of WL for all channels.
Requests to retrieve playlist details (playlists.list) for a channel's
watch history or watch later playlist will return an empty list after
September 12, 2016. Requests to retrieve playlist items
(playlistItems.list) in either of those playlists will also return an
empty list after that time. This is true for the new values, HL and
WL, as well as for any watch history or watch later playlist IDs that
your API Client may have already stored.
I have an (ok-working) extension thats only feature right now is to show the total length of time of a YouTube playlist. Right now you have to refresh the page (any page with a playlist on it) in order for the length to show up. I use playlists.list and playlistItems.list to get length details of each video in the playlist, you can view the source here. (Btw, you should totally comment on my code quality, I like feedback) As you can see from the revision, this extension won't work after September 12th for watch later playlists.
Anyways, the most useful case of my extension is to see how long it would take to get through your watch later playlist. Currently I know that it would take me 4 Days 17 Hours 7 Minutes and 10 Seconds to watch all 365 videos on my watch later playlist. After September 12th, I will not be able to know this information.
How am I supposed to get this information about my watch later playlist then? Which resource do I hit up? Is the next reasonable course of action to get hired by YouTube to work on their backend just to add the total length of time to watch a playlist into playlist.list?

This data will not be available via the YouTube API service after September 15, 2016.

The changelog confirms that the watch history and watch later playlists return empty lists. Unfortunately, no alternative is mentioned.
September 15, 2016.
In addition, requests to retrieve playlist details (playlists.list) or playlist items (playlistItems.list) for a channel's watch history or watch later playlist now return empty lists. This behavior is true for the new values, HL and WL, as well as for any watch history or watch later playlist IDs that your API Client may have already stored.

Related

How to get metrics from YouTube Analytics API for every video which belongs to current user?

I want to get metrics (such as likes, views and subscribers gained) for every video in my youtube channel (or about 10 latest video) , how can I do it correctly?
I'm using such API call from Youtube Analytics API, but it turns out that it returns total views and total likes from all videos, not individually about every video.
`https://youtubeanalytics.googleapis.com/v2/reports?metrics=views,likes,subscribersGained&ids=channel==MINE&startDate=2014-07-03&endDate=2020-06-01&&key=${apiKey}&access_token=${token}`
I read documentation of YouTube Analytics API and I can't find this information there.
If you want the response to be grouped by video your have to specify the dimension parameter to video.
Here is a sample request from the documentation (Basic stats/Top 10 – Most watched videos for a channel):
https://developers.google.com/youtube/analytics/sample-requests#Channel_Reports
Although the note does not specify it, the sort parameter must be the first metric that you declared.
If want to get information on more that 10 videos or to pull information for the latest videos, you can specify the dimension as video and you must specify the video ids in the filter parameter as video==VIDEO1_id,VIDEO2_id....
The videos in a channel can be retrieved through the YouTube Data API from the search endpoint.
You will get a list of videos with their details as a response, among others the videoId and publishedAt values.

Was User Watch History removed in YouTube Data API v3?

If you look at YouTube V3 Docs it will say
YouTube uses playlists to identify special collections of videos for a channel, such as: (...) watch history (...).
Now, if you go to Channels List API and make a call for part=contentDetails&mine=true it will list your information but watchHistory will appear as HL and watchLater as WL.
It makes me wonder, and so far I couldn't find any explicit mention, from Google/YouTube, were those playlists removed from API? IS there any way to actually get that information from an authenticated user?
For quite some time I observed the same values you mentioned on various channels. According to the docs, watch history and watch later playlists are deprecated.

Youtube API - Difference between number of videos from channel statistics and number of videos uploaded

I am trying youtube API to get the number of videos using the call
https://www.googleapis.com/youtube/v3/channels?part=statistics&id=[id]&key=[key]
However, there is a mismatch in the number of uploaded videos. There are 178 videos uploaded in the channel and the channel statistics API is showing 177.
Why is the difference of 1 count?
UPDATE
After 3 days, I got the correct count from channel statistics API.
Still, the question is "Is there a chance to get the difference?"
If that is the case, I would prefer to use the number of videos uploaded instead of the channel statistics.
Watch time report shows the following data collected from youtube.com, the video watch page, mobile Youtube apps (some data is only available from youtube.com).
Note: Analytics views data is based in Pacific Standard Time, updated once a day, and has a delay of up to 72 hours. The numbers you
see in Analytics reports might be different from the numbers you see
on the video page, channel page, Video Manager, or other sources.
Then I suggest that you use the number of videos uploaded.

How to get average watch time for a youtube video?

According to Youtube Analytics documentation, you can only get watch time for videos uploaded to your own channel, and you can't get it for playlisted videos (except in the context of a playlist, which is useless to me). The documentation also states that if you want to access watch time information, you need a permission from the owner of the channel.
https://developers.google.com/youtube/reporting/#Report_Contents
Is it possible to get Average Watch Time for any youtube video using Youtube data API or Analytics API, or using any other source and how?
You may check averageViewDuration which is the average length, in seconds, of video playbacks. In a playlist report, the metric indicates the average length, in seconds, of video playbacks that occurred in the context of a playlist.
Example:
Total view counts, estimated watch time, and more for a channel
This query retrieves 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.
metrics=views,comments,likes,dislikes,estimatedMinutesWatched,averageViewDuration
Hope this helps!

Watch Later playlist url via YouTube API

Is it possible to get the link for a users watch later playlist using the YouTube api? I'm trying to generate a url to start playing the watch later playlist from the first video, so that the final link would be something like youtube.com/watch?v=videoID&list=playlist. I'm using the YouTube Data API v3.
Unfortunately, it looks like as of this month Google has deprecated access to the Watch Later playlist via the public API:
The channel resource's contentDetails.relatedPlaylists.watchHistory
and contentDetails.relatedPlaylists.watchLater properties now contain
values of HL and WL, respectively, for all channels. (The properties
are only visible to an authorized user retrieving data about the
user's own channel.)
In addition, requests to retrieve playlist details (playlists.list) or
playlist items (playlistItems.list) for a channel's watch history or
watch later playlist now return empty lists. This behavior is true for
the new values, HL and WL, as well as for any watch history or watch
later playlist IDs that your API Client may have already stored.
See the full revision history for more information.
You should do a channels->list with mine = true.
Then from the channel response, you will get the watchlater-playlistID.

Resources