php - Get most popular videos of a channel by its name -
I am trying to list the most popular (or latest) video of a channel using the YouTube 3.0 API.
I have already implemented it, just not sure that this is the right way to do this, therefore advice is needed.
First of all, I get the Channel ID by name (for example, instead of Then I get a video of this channel ID, which is ordered by How reliable is the first request? If the name is the exact match of the channel URL slug or username (such as tdstalk), will he always bring this channel back? Or is there a more reliable way to get Channel ID by its name? Thank you. The search API is not for exact match queries and this is the name of all the channel titles (the username is present in the URL, If present), channel name (xxx added 1 video) and even channel id! Unfortunately, it is not reliable and there is no other reliable way. Try to query a quick example, username "ABC" {YOUR_API_KEY} Search API response ABCNetwork, ABC News, UDRIZZEC ... And so will come back. The first 50 items do not contain any channel title (user name) "ABC". Even if not all the users have a username, you should use the Channel AP for an exact match query, {YOUR_API_KEY} You might wonder why the YouTube API "Channel Name" (xxx 1 added video)? This is because the name of the channel is not unique, because the name of a person is not unique. As indicated: If you are using v3 and want to recover the channel ID associated with the current authorized user, List (Part = "Id", My = True) Method. This is equivalent to asking for the default user's channel profile in v2. If you can ever find yourself with an arbitrary legacy YouTube username, you need to translate the channel ID into the API using v3, you will be able to access a channel.list ( Part = "ID", URL = "Username") for the URL. If you know only one display name and want to search for this channel, search .list (part = "snippet", type = "channel", q = "display name") method works in Will come. You should be prepared to deal with the possibility of returning multiple items in response, since display names are not unique. Finally, I do not know why YouTube did not do so to generate a unique readable username (such as Facebook for a new user, at the end of the duplicate username, a random Adds the number, e.g., Zak5 and Z.21). Reference: TEDxTalks> {Channel_name} ):
viewCount (or
date ) The list of videos that is completely:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId= {channel_id} and command = viewcount & Amp; Type = Video & amp; Key = {API_KEY}
Comments
Post a Comment