YouTube

YouTube API v2.0 – Retrieving and Searching for Channels

Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information.

The following sections explain how to use the API to retrieve a list of channels matching a user-specified search term or to retrieve standard feeds of the channels with the most video views or subscribers:

  1. Searching for channels
  2. Standard feeds for channels

You can search for channels matching a user-specified search term by sending a GET request to the following URL and using the q query parameter to specify a search term. YouTube could match the search term to the channel name, description or other channel-related fields.

https://gdata.youtube.com/feeds/api/channels

YouTube supports the following API query parameters for channel search:

Note: Since the query term could be matched against the channel description, the q parameter value could contain multiple words. You can also search for an exact phrase as described in the q parameter definition. However, for channel search requests, the q parameter does not support the Boolean NOT (-) and OR (|) operators.

Sample channel search request

The following API request searches for the second set of 10 channels matching the query term "soccer":

https://gdata.youtube.com/feeds/api/channels?
    q=soccer
    &start-index=11
    &max-results=10
    &v=2

This request yields the following response:

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
  xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/'
  xmlns:batch='http://schemas.google.com/gdata/batch'
  xmlns:yt='http://gdata.youtube.com/schemas/2007'
  xmlns:gd='http://schemas.google.com/g/2005'
  gd:etag='W/"CEEERnk_fCp7ImA9WxRUEU4."'>
  <id>tag:youtube.com,2008:channels</id>
  <updated>2008-11-19T14:10:07.744-08:00</updated>
  <category scheme='http://schemas.google.com/g/2005#kind'
    term='http://gdata.youtube.com/schemas/2007#channel'/>
  <title>YouTube Channels matching query: soccer</title>
  <logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>
  <link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml'
    href='https://gdata.youtube.com/feeds/api/channels?v=2'/>
  <link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml'
    href='https://gdata.youtube.com/feeds/api/channels/batch?v=2'/>
  <link rel='self' type='application/atom+xml'
    href='https://gdata.youtube.com/feeds/api/channels?q=soccer&start-index=11&max-results=10&v=2'/>
  <link rel='service' type='application/atomsvc+xml'
    href='https://gdata.youtube.com/feeds/api/channels?alt=atom-service&v=2'/>
  <link rel='next' type='application/atom+xml'
    href='https://gdata.youtube.com/feeds/api/channels?q=soccer&start-index=21&max-results=10&v=2'/>   
  <author>
    <name>YouTube</name>
    <uri>http://www.youtube.com/</uri>
  </author>
  <generator version='2.0' uri='http://gdata.youtube.com/'>YouTube data API</generator>
  <openSearch:totalResults>6141</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>25</openSearch:itemsPerPage>    
  <entry gd:etag='W/"CEEERnk_fCp7ImA9WxRUEU4."'>
    <id>tag:youtube.com,2008:channel:dXNzb2NjZXJkb3Rjb20</id>
    <updated>2008-11-19T14:10:07.744-08:00</updated>
    <category scheme='http://schemas.google.com/g/2005#kind'
      term='http://gdata.youtube.com/schemas/2007#channel'/>
    <category scheme='http://gdata.youtube.com/schemas/2007/channeltypes.cat'
      term='director'/>
    <title>U.S. Soccer</title>
    <summary>
      ussoccer.com's comprehensive coverage of the U.S. National Teams welcomes
      fans to our YouTube channel - including interviews, press conferences...
    </summary>
    <link rel='http://gdata.youtube.com/schemas/2007#featured-video'
      type='application/atom+xml'
      href='https://gdata.youtube.com/feeds/api/videos/bYKugypF8HA?v=2'/>
    <link rel='alternate' type='text/html'
      href='https://www.youtube.com/profile?user=ussoccerdotcom'/>
    <link rel='self' type='application/atom+xml'
      href='https://gdata.youtube.com/feeds/api/channels/dXNzb2NjZXJkb3Rjb20?v=2'/>
    <author>
      <name>ussoccerdotcom</name>
      <uri>https://gdata.youtube.com/feeds/api/users/ussoccerdotcom</uri>
      <yt:userId>k1pcWQ5E19g0Cgp4c1eI1w</yt:userId>
    </author>
    <yt:channelId>UCk1pcWQ5E19g0Cgp4c1eI1w</yt:userId>
    <yt:channelStatistics subscriberCount='29317' viewCount='1737927'/>
    <gd:feedLink rel='http://gdata.youtube.com/schemas/2007#channel.content'
      href='https://gdata.youtube.com/feeds/api/users/ussoccerdotcom/uploads?v=2'
      countHint='513'/>
    <media:thumbnail url='http://i.ytimg.com/i/k1pcWQ5E19g0Cgp4c1eI1w/1.jpg'/>
  </entry>
  <entry>
    ...
  </entry>
  ...
</feed>

Each entry in the response contains information about a YouTube channel that matches the search request. Entries contain the following information:

  • The <title> and <summary> tags specify a name and description of the channel, respectively.

  • The <author> tag identifies the owner of the channel, and the <uri> tag within the <author> tag specifies the feed URL that you would use to retrieve more information about the channel owner.

  • The <gd:feedLink> tag, which has a rel attribute value of http://gdata.youtube.com/schemas/2007#channel.content, identifies the URL that you would use to retrieve a feed of the videos in the channel.

  • The <link> tags contain links relevant to the channel, including a link to the channel's featured video and a link to the channel owner's profile page.

  • One <category> tag specifies that the entry contains information about a channel. An additional <category> tag may be present indicating that the type of channel that the entry describes. Channel types include director, guru and musician. See http://gdata.youtube.com/schemas/2007/channeltypes.cat for a complete list of channel types.

Standard feeds for channels

The API also lets you retrieve standard feeds that list the most viewed or most subscribed YouTube channels. Standard channel feeds are only supported in version 2 of the API. To retrieve a standard channel feed, send a GET request to the URL associated with that feed.

The following table identifies the URL associated with each standard feed:

Name Feed Id URL and Description
Most viewed most_viewed URL: https://gdata.youtube.com/feeds/api/channelstandardfeeds/most_viewed?v=2
Description: This feed lists the most frequently watched YouTube channels. This metric accounts for all views of videos uploaded to a channel.
Most subscribed most_subscribed URL: https://gdata.youtube.com/feeds/api/channelstandardfeeds/most_subscribed?v=2
Description: This feed lists the channels with the most subscribers or the most new subscribers during a given time period.

The XML excerpt below shows the format of a standard channel feed entry:

<entry>
  <id>tag:youtube.com,2008:standardchannel:expertvillage</id>
  <updated>2010-10-28T19:07:55.377Z</updated>
  <category scheme='http://schemas.google.com/g/2005#kind'
    term='http://gdata.youtube.com/schemas/2007#channelstandard'/>
  <title>Expert Village - Watch and Learn</title>
  <summary>Welcome to the official YouTube channel of Expert Village. We
    are known for our largest choice of informative videos from trusted
    sources to provide answers to your everyday questions.</summary>
  <link rel='self' type='application/atom+xml'
    href='https://gdata.youtube.com/feeds/api/channelstandardfeeds/most_viewed/c/expertvillage?v=2'/>
  <author>
    <name>expertvillage</name>
    <uri>https://gdata.youtube.com/feeds/api/users/expertvillage</uri>
    <yt:userId>QlGBspQdj17WOPBQMT1k9A</yt:userId>
  </author>
  <yt:channelId>UCQlGBspQdj17WOPBQMT1k9A</yt:channelId>
  <yt:channelStatistics commentCount='887' totalUploadViewCount='1481786054'
    videoCount='138756' viewCount='22295173'/>
  <media:group>
    <media:thumbnail
      url='http://i2.ytimg.com/i/QlGBspQdj17WOPBQMT1k9A/1.jpg?v=89e277'/>
    <media:title>Expert Village - Watch and Learn</media:title>
  </media:group>
</entry>

Both standard channel feeds support the time query parameter, which lets you restrict the feed to only contain relevant results from the previous day, week or month. For example, to retrieve the most viewed channels from the previous day, you would send a GET request to the following URL:

https://gdata.youtube.com/feeds/api/channelstandardfeeds/most_viewed?time=today&v=2

Note: YouTube does not generate a feed of the most subscribed channels from the previous day. As such, the only supported values of the time parameter for the most_subscribed feed are this_week, this_month, and all_time.

Retrieving region-specific standard channel feeds

The API enables you to retrieve region-specific standard channel feeds by inserting a region ID in the feed URL. (You would also use a region ID to retrieve a region-specific video feed.) The following URL shows the format of the request URL for retrieving region-specific standard channel feeds:

https://gdata.youtube.com/feeds/api/channelstandardfeeds/regionID/feedID?v=2

For example, to retrieve a list of the most-viewed channels in Sweden, you would send a GET request to the following URL:

https://gdata.youtube.com/feeds/api/channelstandardfeeds/SE/most_viewed?v=2

See the Retrieving region-specific standard video feeds section for a list of supported countries and their associated regionID values.

Retrieving standard channel feeds by user type

You can retrieve standard channel feeds for specific types of users by appending an underscore and a user type to the feed type in the feed URL. For example, the following URL retrieves a feed of the most viewed musician channels in the United States:

https://gdata.youtube.com/feeds/api/channelstandardfeeds/US/most_viewed_Musicians?v=2

Valid user types that can be appended to the feed URL are Comedians, Directors, Gurus, Musicians, Non-profit, Partners, Politicians, Reporters, and Sponsors. These values are case-sensitive and can be found in the channeltypes.cat XML document.

Note: If you request a standard channel feed for a specific user type, you can also specify a region.

pagination links

« Previous
Retrieving Data for a Single Video
Next »
Searching for Playlists

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.