I need to know the equivalent request in YouTube Data API v3 as this v2 request for retrieving all the new subscription videos.
https://gdata.youtube.com/feeds/api/users/default/newsubscriptionvideos
I have not seen any simple and clean requests that are as simple as the v2 version of the reques
You can retrieve this information with the Youtube V3 API but it is incredibly inefficient:
First get the channel ID from the username (one request).
Now get the subscriptions for the channel (batchable - one request per 50 subs).
Now get the playlists for each subscribed channel (batchable - one request per 50 subs).
Get the most recent playlistItems for the "uploads" system playlist of each channel. (one request per sub).
Get the video related to each playlistItem (batchable - one request 50 playlistItems).
You can now sort the videos by publishing date and print the most recent.
If you have 100 subscriptions and fetch 5 videos from each channel this will result in 114 API requests and use around 500 quota units (the daily limit is 50 million units). It will also take about 2 minutes to run if you don't parallelize the API calls.
This method does have a couple of benefits over using activites though:
You can do it for any user with public account settings, not just the authenticated user, so it works like the V2 API in that respect.
It won't randomly lose videos like the Youtube homepage does.
A full Python implementation is available: https://github.com/ali1234/ytsubs
There is not an exact equivalent but you can get close with
youtube.activities.list(part=”snippet”, home=true)
then filter the one with snippet.type = upload
For anyone who's interested in retrieving the newly uploaded videos "today" like how it's done in /feed/subscriptions, use "search API" (link).
In this case, it requires 2 APIs. The search API and the subscriptions API (link)
Get the channels IDs using the subscription API
For each channel id, use search Id with channelId, publishedAfter and publishedBefore parameters.
Then filter out results that have items.length == 0.
Then now, you can filter only the most recent videos uploaded by the subscribed channels.
EDIT: Search API costs 100 quota.:
A call to this method has a quota cost of 100 units.
Playlist item API costs 3 quota:
A call to this method has a quota cost of 1 unit in addition to the costs of the specified resource parts.
So ... it's a lot cheaper to cache uploads playlist ids from the "channels API" and use the playlist.
Or to be able to filter by publish dates like search API, use the Activities API which has publishedBefore and publishedAfter parameters.
Related
I'm using the YouTube Data API v3 to insert videos from my website to my youtube channel. It is all working fine. Youtube gives 10000 queries per day limit and I requested to extend the quota as one video upload takes about 1607 queries and hence my limit for uploading videos is 6.
The response I received from YouTube is that my API Client is in violation of Youtube's policy fo storing data. They have mentioned that
store_youtube_api_length: twelve months
and they want it to be set to under 30 days.
I have searched the google console for this setting but I'm unable to find it. I have asked Youtube and they have brushed off the request saying they are part of YT compliance team.
Can somebody here help me find it.
Responding to the YouTube API Services confirming our data retention policy was under the month limit fixed this for us. It was just an internal policy agreement, no setting to update.
I'm trying to make a system where I fetch all YouTube comments
using YouTube v3 API and my agents will reply to those comments from the system and that's will be published into YouTube.
Now the problem is if I want to get all comments in a short time then every time I have to crawl all videos and comment's for checking a new comment. Which is very costly in API calls.
Now I'm searching for webhooks, which will notify or send me the new comment, expecting like what I get from Facebook Webhooks.
YouTube webhook for comment or like Not available yet. Only way to hit their server for find new comment. It's have a API which give all comment of a channel.
As you said there isn't any such YouTube webhook to get notified when a new comment is posted.
However I would recommend you to use CommentThreads: list with allThreadsRelatedToChannelId which has by default order time (most recent first). Likewise by just making a single YouTube Data API v3 request periodically you will get fastly and without spending a lot of your quota the latest comments on your YouTube channel (on your videos and also on you "Community" tab). If more than maxResults (maximum 50) comments are published during a period you can use nextPageToken to continue to browse these new comments.
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.
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.)