Youtube API get channels a user is a subtitle editor for - youtube-api

Is is possible to query the YouTube api for channels that a user is a Subtitle Editor for? I can't seem to get this work using the Channel list endpoint.
I'm looking at the channels endpoint described here.
It appears that there are at least 4 ways to use this endpoint:
List by channel id
List by YouTube username
List my channel
List channels managed by a content owner.
I was hoping that channels that a user is the Subtitle Editor for would be returned in the the ListByYouTubeUsername query but this doesn't seem to be the case. It it possible to get this data using the API?

Related

YouTube Data API returns channel for user without channel

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.

Archival lists of most subscribed YouTube accounts?

Is there a way to find the top X YouTube accounts by subscriber count for Y year---say, the top 100 accounts in 2015? I don't see anything in the API docs, and while there are services like SocialBlade and VidStatsX, they don't provide archived lists, and the data is not captured on archive.org.
The standard Analytics API doesn't provide this functionality. You can get data about views, likes, and dislikes, but you must provide one or more channel IDs.
Required Parameters: ids
Identifies the YouTube channel or content owner for which you are
retrieving YouTube Analytics data.
To request data for a YouTube
channel, set the ids parameter value to either channel==MINE or
channel==CHANNEL_ID, where CHANNEL_ID identifies the currently
authenticated user's YouTube channel.
To request data for a YouTube
CMS content owner, set the ids parameter value to
contentOwner==OWNER_NAME, where OWNER_NAME is the CMS user ID for the
user.
Use the Try this API section on the reference page to test the possibilities.

List of subscribers to a YouTube channel

Is there any way I can create an HTML list of subscribers to a channel using the YouTube APIs?
I searched for something on this site:
API - Youtube
There is this term, but I do not know if this is the way:
youtube.activities.list, which returns all the events of a channel.
EDIT
How would I get with my channel subscribers?
You cannot access another Person's subscriber list. Only the channel owner can do that. You can get the subscriber amount though.

How do I get a list of YouTube channels, and associated channel URLs (user or channel), owned by an authenticated user

We use the following call to get ChannelID's for an authenticated user and it works well for most cases. Some YouTube user connect their channels to a Google+ page and this fails for one of our users in that situation. In that case, the call only returns the channelID associated the user's email account used for authentication, not all channels owned by the user.
System.IO.Stream resultStream = service.Query(new Uri("https://www.googleapis.com/youtube/v3/channels?part=id%2Csnippet%2CcontentDetails%2Cstatistics%2CtopicDetails&mine=true&key=" + GlobalSettings.developerKey));
Also, we construct the channel URL by appending the channelID to the following URL.
http://www.youtube.com/channel/
However, some channels us a user name and path instead of channelID. How can I detect that the type is user instead of channel? In that case the user name is appending to the following path. The Google+ user's main channel uses this path with a user name.
http://www.youtube.com/user/
A few things:
In v3 of the YouTube Data API, you're forced to work with channel ids everywhere. This is a good thing. Channel ids are the only universal way of identifying channels! Legacy usernames used to serve that purpose as well, but the number of channels without legacy usernames is increasing by the day, so writing new v2 code that relies on legacy usernames is not recommended (and isn't possible in v3).
When making a channels.list(..., mine=true) call, you're always going to get back exactly one channel. The channel you get back will depend on which channel was chosen when you went through the OAuth 2 flow—there's a picker within that flow that lets you choose whichever channel you'd like if your Google Account happens to have access to more than one channel. If you want to operate on a different channel, you need to explicitly obtain an OAuth 2 token for that channel.
channel.list(..., managedByMe=true) can return multiple channels, but that API call is only relevant to YouTube content partners, and is used hand-in-hand with the onBehalfOfContentOwner parameter. Most developers can safely ignore this unless you know you're explicitly working with YouTube content partners' accounts.
The URL to visit a channel's page isn't returned anywhere in the v3 API response—that's true, and maybe it should be (feel free to file a feature request). If you want to manually construct the URL, you can use http://www.youtube.com/channel/CHANNEL_ID, where CHANNEL_ID is the standard UC... value that is used everywhere else in v3. That should produce a valid URL regardless of whether there's also a legacy username for the channel.
The only way that I have been able to do this is to use the v2 API, instead of v3. Specifically, you can use the same OAuth token, but access this API endpoint:
https://gdata.youtube.com/feeds/api/users/default?v=2
It will return an XML doc that contains both a URL to the user's channel (using the channel id), as well as the YouTube username.
See https://developers.google.com/youtube/2.0/reference#User_profile_entry for more info.

YouTube Analytics API Questions

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).

Resources