I'm using the YouTube Analytics API to retrieve total views for channels. For small channels the total views match the number visible on the about tab of the channel. On larger channels there's a huge difference. For example one channel is reporting 1.6 billion via analytics api where the public page is reporting 490 million. Why is there a difference?
GET https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DMINE&start-date=2010-01-01&end-date=2014-10-03&metrics=views%2Ccomments%2CfavoritesAdded%2Clikes%2Cdislikes%2CestimatedMinutesWatched%2CaverageViewDuration&key={YOUR_API_KEY}
Can be the difference is between public and private view.
If a video has lot of views but public cannot see her, YouTube doesn't count this view in public.( counter like about page.)
YouTube Analytics count this private view.
we'll remove view counts from unlisted and private videos so the view
count shown for a channel will include only the views from public
videos. If you have private or unlisted videos that you want to count
towards your channel's view count, you can simply set them to "public"
and they will be included in your view count within a day.
source
Related
Does anyone know how this website is able to get historical views data for YouTube playlists?
From my research, YouTube API doesn't even let you get the current playlist views (I might be wrong).
I am talking about the playlist views, not the views from videos that were added to the playlist (you can see the view count here for example, on the left side - on desktop).
How can we get access to this type of data?
One more time YouTube Data API v3 doesn't provide a basic feature.
I would recommend you to use my open-source YouTube operational API. Indeed by requesting the JSON document https://yt.lemnoslife.com/playlists?part=statistics&id=PLAYLIST_ID containing item["statistics"]["viewCount"] integer, your problem is solved.
You can request up to maxResults (currently 50) playlists separating playlist ids by a comma in id, example: https://yt.lemnoslife.com/playlists?part=statistics&id=PLAYLIST_ID_0,PLAYLIST_ID_1,...,PLAYLIST_ID_49
You can also request the title of the playlist by adding snippet to part, example: https://yt.lemnoslife.com/playlists?part=snippet,statistics&id=PLAYLIST_ID
I want to get channel IDs for all YouTube channels in Japan.
I tried to set the following parameters and call /search of YouTube Data API v3.
part: id
maxResults: 50
regionCode: jp
type: channel
pageInfo.totalResults in the API response is about 200,000 but actually I can only get 583 channel IDs.
583 is too little even if pageInfo.totalResults is an approximate value.
I would like to know how to get all the channel IDs in Japan, either by using the API or not.
I hope you will be able to provide the related information.
I tried to do almost the same for France. As said #stvar there isn't any appropriate endpoint to do so. However with patience and work we can make a kind of work around. My method only retrieves Japanese YouTube channels having indirectly publicly interacted with your starting set (see below).
Get a good starting set (in order to maximize the discover of the Japanese YouTube channels graph). I recommend you for instance to retrieve the top 100 Japanese YouTube channels sorted by view count by using SocialBlade.
For each channel discovered by the comments retrieved at step 3 (automatically) choose whether or not it is a Japanese YouTube channel. You can retrieve this piece of information if it is available for the channel in the "About" tab. To do it in an automatic way check whether or not snippet["country"] == "JP" in https://youtube.googleapis.com/youtube/v3/channels?part=snippet&id=CHANNEL_ID&key=YOUR_API_KEY If country isn't defined you can try to guess (automatically) whether or not it is a Japanese YouTube channel by making more complex checks see isFrench function. These checks are based on "About" tab and uploaded videos.
If the channel is interesting you (is Japanese) retrieve all comments (and so the YouTube channel about channel's videos and in the community tab using CommentThreads: list with part containing snippet and allThreadsRelatedToChannelId filter. If this method doesn't return any data because a video has disabled comments then retrieve the videos list and comments associated using (a) then CommentThreads: list with filter videoId. The approach (a) consists in getting the uploads auto-created playlist id of the YouTube channel by using Channels: list with contentDetails in part and then use PlaylistItems: list to retrieve all public videos uploaded on this YouTube channel. And if the YouTube channel contains more than 20 000 videos which is the upper limit for playlist size, use this script instead of (a). The script consists in faking requests done when browsing videos on a YouTube channel.
Then continue to dive into the Japanese YouTube channel graph by discovering Japanese YouTube channels through the comments found in your starting set and so on.
You can have a look for more details and some helping tools on my GitHub repository dedicated to the same approach for France (I was trying to list all comments let on French YouTube videos).
Of course you might need multithreading and group your YouTube Data API v3 request to reach maxResults upper limit in order to maximize your quota efficiency. Good luck.
I have tried to use the new YouTube API to get the videos with the highest view count of all time.
I have tried to use this request:
GET https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&maxResults=10&order=viewCount&safeSearch=none&key={YOUR_API_KEY}
I thought it would work. It returns 10 videos that have a quite high view count and are sorted in a descending order by view count. However, those videos are definitely not the absolute top 10.
Is there a way to make YouTube API return the real top of most viewed videos?
I've been using the YouTube Analytics API (I'm using the Java library), to retrieve analytics data for a YouTube Channel - I've been filtering the API calls to specific videoIDs.
However the data for the same date range, when I look in YouTube Analytics (the web interface) seems to differ.
Data from the YouTube Web Interface:
Data from the API:
Does anyone have an explanation for this ?
It says from this SO post that it is an intended behavior of both the API and the Youtube Analytics web interface.
To support this similar post, based from the documentation - How video views are counted:
If you're looking at a video you uploaded, you can monitor your views
more closely using YouTube Analytics. However, keep in mind that the
Realtime report only shows estimates of potential view activity and
might not match the number you see on the watch page.
Also, there are called Frozen View Count where on some videos, the view count might seem frozen or not show all the views that you expect. Video views are algorithmically validated to maintain fair and positive experiences for content creators, advertisers, and users. To verify that views are real and accurate, YouTube may temporarily slow down, freeze, or adjust the view count, as well as discard low-quality playbacks.
I can't find anything on the web or the API docs for how to retrieve the very simple graph that shows up when you check the stats of a YouTube video right on the video page; that is, when you click the "Video Statistics" button to the right of the View Count on a video.
I just want a graph that starts at 0 views when the video was first uploaded to the number of views now; it should increase cumulatively with time. Anyone know how to get this?
Note -- I don't want data broken down per day (I'm aware of the new Analytics API).
The newly public YouTube Analytics API should allow you to get that sort of data (views broken down by day over a period of time).
https://developers.google.com/youtube/analytics/