Hi I want to attract the last 30 day views of the channels with youtube apis but somehow I could not. Does anyone have an idea?
I've tried it with Youtube Analytics api, but it only values "channel == mine". that is not.
YouTube analytics Data is private data. Inorder to see the data for a channel you must be authenticated as the owner of that channel.
YouTube authorization is also channel based if you are having issues seeing one of your channels logout of your application and authenticate it again make sure to select the proper channel when promoted
Related
New to using the YouTube API/data scraping in general, and I was wondering exactly what the authentication for the statistics.dislikeCount() in the Videos section entails? Does it mean that we would have to obtain consent for each channel for which we want to view the dislike count individually? How would one go about doing so?
statistics.dislikeCount
unsigned long
Note: The statistics.dislikeCount property was made private as of December 13,
2021. This means that the property is included in an API response only if the API request was authenticated by the video owner. See the
revision history for more information.
The number of users who have indicated that they disliked the video.
Blockquote
Source: videos#statistics.dislikeCount
So it's not just about consent as far as I understand, you have to be the owner of the YouTube channel to be able to retrieve the dislikes of its videos.
I've got a YouTube user, which doesn't contain a YouTube channel. But the YouTube data API does return a channel, if I query the youtube.channels.list API method by using the "mine=true" attribute like in following example (1).
Example:
(1) Returns a channel (mine=true; by using OAuth):
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list?part=snippet%252CcontentDetails%252Cstatistics&mine=true&_h=5&
This query (1) returns a channel which contains a channelId. Now I'm trying to query for the playlists of this channel by using the previously returned channelId.
(2) Returns a 404 "channel not found" error
https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlists.list?part=snippet&channelId=UCIReEy02ibumfYhQP3-0drQ&_h=4&
As described here it's possible to use a YouTube account without a channel but with limited functionality like using playlists:
With a Google Account, you can watch and like videos and subscribe to channels. However, without a YouTube channel, you have no public presence on YouTube. Even if you have a Google Account, you need to create a YouTube channel to upload videos, comment, or make playlists. You can use a computer or the YouTube mobile site to create a new channel.
What's the reason query (1) is returning a channel even if a YouTube account doesn't contain a channel?
BR
ninsky
[1] Returns a channel (mine=true; by using OAuth):
Because of every account on youtube itself a channel. They can do all the things they want like any channel can do e.g. upload videos. Also, we can make multiple channels under the same account.
[2] Doesn't return a channel (forUsername=UCIReEy02ibumfYhQP3-0drQ; by/without using OAuth):
Please make sure UCIReEy02ibumfYhQP3-0drQ is a valid username
I'm building something with the YouTube API. I've found a few oddities so far. The first thing is that a channel can have a title of 'blah blah - Topic' so you probably want to screen those out if you want to retrieve channels with their own content. If I'm right in my thinking, these are just channels with Playlists. Example: https://www.youtube.com/channel/UC6tQSWkTxbPNaJ_LQ-Ia6jQ/
Also be aware that channels don't have to have a unique title.
Finally there are many channels that return nothing from the API Channels.List method, even though they are channels. I'm still figuring these out. I don't think they are returned from searching through the API, but if you get your Channel IDs from another source then this could be an issue.
In an youtube account I have more channels.
Exists an api call to retrieve all the channels for my account?
I want to upload videos to different channels in function of some video properties. I think that the problem is that I authorize access to my global account don't give automatic authorization for all channels. I have a refresh-token for offline upload (I use this refresh token to retrieve the token for video upload).
If I retrieve channel list from api, always return only one channel and not all my channels.
You are going to need to authenticate once for each channel. The YouTube API is different then other Google APIs.
Refresh tokens are - project, channel based not project, user based.
So if you have five channels and you want to access them all you will need five refresh tokens one for each channel.
I'm new to the YouTube Analytics API, and had a couple of questions:
In order to retrieve Analytics reports, I have to specify the channel ID for the "ids" parameter. How do I find the channel ID for the OAuth-authenticated user? I saw in the Sample Application that I can call Channels.list method in the Data API (V3) and use the "mine=true" parameter. Is this guaranteed to return a single channel? If not, how do I know which channel is the right one? What's the recommended way of finding a user's channel ID?
Once I have the channel ID, I can begin querying for Analytics data. I'd like to query the "views" metric for the channel for the entire history of that channel. The question is, how do I know how far back to query? Is there a channel start date? The Channels.list method mentioned above doesn't return the snippet.publishedAt date for my channel so that doesn't seem to be a reliable way. How else do I know when to stop? I guess I could query back until 2005 or so when YouTube was founded but that seems like a bad approach. Any suggestions?
The Analytics API supports reports for channels as well as content owners. Once a user authenticates via OAuth, how do I know if that account is a regular YouTube account vs a CMS content owner account?
Any help would be greatly appreciated!
The recommended approach is to do a channels.list(mine=true). The first result returned will be the channel corresponding to the currently authorized user. (channels.list() returns a list of channels because there are other combinations of request parameters that could result in more than one channel being returned.)
Going back to some arbitrary date in the past should be harmless. 2005, 2000, etc. The YouTube Analytics backend should know how to properly deal with that, and you'll obviously only get stats that date back to the first views associated with your channel.
The value of the ids= parameter tells the API whether you want to do a report against a channel associated with the current authorized user (ids=channel==UC...) or against channels/videos that you have access to as a CMS content owner (ids=contentOwner==CONTENT_OWNER_NAME).
I want to know if we can use Youtube V3 API to retrieve channel data, videos etc when the channel requested is not the authenticated user's own channel.
The documentation for v3 youtube api (https://developers.google.com/youtube/v3/docs/channels/list#try-it) says "The list method returns a collection of zero or more channel resources that match the request criteria. At this time, this method does require an authenticated user, and the API only supports requests to retrieve information about the channel that is associated with the currently authenticated user."
Example in V2 it is http://gdata.youtube.com/feeds/api/users/{user_name}, what is the equivalent in v3 ? Is it available yet ?
You can request a channel by ID e.g. Lady Gaga channel:
https://www.googleapis.com/youtube/v3/channels?id=UCNL1ZadSjHpjm4q9j2sVtOA&key=AIzaSyCR5In4DZaTP6IEZQ0r1JceuvluJRzQNLE&part=snippet,contentDetails
The plan is to support retrieving both channel profile information and the ids for the uploads/favorites/playlist/etc. feeds for a given channel in v3. It's not quite yet supported, but should be around the time of the public launch. (Which, I can't commit publicly to a date for that at this time.)