YouTube

YouTube API v2.0 – Video Feed Types

This page describes several different types of video feeds that can be retrieved using the YouTube API. A video feed contains a list of videos that would be displayed in a list on your site. You can use standard API query parameters to customize the number of videos that you retrieve.

This page explains how to retrieve the following types of video feeds:

  1. Videos feeds
  2. Videos uploaded by a specific user
  3. Standard video feeds
  4. Video responses
  5. Related videos
  6. User's favorites feed

Videos feeds

The API returns a videos feed in response to a request to search for videos. A videos feed contains a maximum of 999 entries. To retrieve search results, send an API request to the following URL:

http://gdata.youtube.com/feeds/projection/videos?v=2

Search requests can use any of the API's standard or custom query parameters. For example, the following URL requests all videos related to the query "skateboarding dog," starting with the 21st search result and returning 10 results:

http://gdata.youtube.com/feeds/api/videos?
     q=skateboarding+dog
     &start-index=21
     &max-results=10
     &v=2

Videos uploaded by a specific user

This section explains how to retrieve a feed containing all of the videos uploaded by a specific user. You should not include search parameters in requests to retrieve an uploaded videos feed. The parameters will generate a feed from YouTube's search index, effectively restricting the result set to indexed, public videos, rather than returning a complete list of the user's uploaded videos.

  • To request a feed of all videos uploaded by the currently logged-in user, send a GET request to the following URL. This request requires an authentication token, which enables YouTube to identify the user.

    https://gdata.youtube.com/feeds/api/users/default/uploads

    To ensure that the API response contains the most up-to-date information available for the user's videos, do not use any parameters other than start-index and max-results in your request. Requests using other parameters, such as orderby, will return cached results.

    Note: In the URL, the value default signifies that you are requesting videos uploaded by the currently logged-in user. The user is identified by the authentication token that you submit with the request. The default value is also used to identify the currently logged-in user in other API commands.

  • To request a feed of all videos uploaded by another user, send a GET request to the following URL. Note that this request does not require authentication.

    https://gdata.youtube.com/feeds/api/users/username/uploads

    In the URL above, you must replace the text username with the user's YouTube username. You can extract the username from the <name> tag in an API response as shown in the following example.

    <author>
      <name>GoogleDevelopers</name>
      <uri>https://gdata.youtube.com/feeds/api/users/GoogleDevelopers</uri>
    </author>
    

The API response for this query has exactly the same format as the sample response in the Understanding video feeds and entries section of this document.

Standard video feeds

This section explains how to retrieve standard YouTube feeds. Standard feeds contain lists of videos that either reflect YouTube user behavior, such as top-rated and most viewed video feeds, or were selected by YouTube staff, such as recently featured and mobile video feeds. Many of these feeds are shown on the Videos tab of the YouTube website.

Standard feeds are updated periodically, with the update frequency varying from feed to feed. Many feeds are updated every 30 to 40 minutes but other feeds – such as those that capture daily, weekly or monthly results – may only be updated hourly or even daily.

To retrieve a standard 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
Top rated top_rated URL: https://gdata.youtube.com/feeds/api/standardfeeds/top_rated
Description: This feed contains the most highly rated YouTube videos.
Top favorites top_favorites URL: https://gdata.youtube.com/feeds/api/standardfeeds/top_favorites
Description: This feed contains videos most frequently flagged as favorite videos.
Most viewed most_viewed URL: https://gdata.youtube.com/feeds/api/standardfeeds/most_viewed
Description: This feed contains the most frequently watched YouTube videos.
Most shared experimental feature most_shared URL: https://gdata.youtube.com/feeds/api/standardfeeds/most_shared
Description: This feed lists the YouTube videos most frequently shared on Facebook and Twitter. This feed is available as an experimental feature.
Most popular most_popular URL: https://gdata.youtube.com/feeds/api/standardfeeds/most_popular
Description: This feed contains the most popular YouTube videos, selected using an algorithm that combines many different signals to determine overall popularity.
Most recent most_recent URL: https://gdata.youtube.com/feeds/api/standardfeeds/most_recent
Description: This feed contains the videos most recently submitted to YouTube.
Most discussed most_discussed URL: https://gdata.youtube.com/feeds/api/standardfeeds/most_discussed
Description: This feed contains the YouTube videos that have received the most comments.
Most responded most_responded URL: https://gdata.youtube.com/feeds/api/standardfeeds/most_responded
Description: This feed contains YouTube videos that receive the most video responses.
Recently featured recently_featured URL: https://gdata.youtube.com/feeds/api/standardfeeds/recently_featured
Description: This feed contains videos recently featured on the YouTube home page or featured videos tab.
Trending videos experimental feature on_the_web URL: https://gdata.youtube.com/feeds/api/standardfeeds/on_the_web
Description: This feed lists trending videos as seen on YouTube Trends, which surfaces popular videos as their popularity is increasing and also analyzes broader trends developing within the YouTube community. This feed is available as an experimental feature.

In addition, please note that many of these feeds support the time query parameter, which allows you to restrict the feed to only contain relevant results from the previous day, week or month. For example, to retrieve top-rated videos from the previous day, you would send a GET request to the following URL:

https://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today

Note: The top_rated, top_favorites, most_viewed, most_discussed and most_responded standard feeds support the time parameter.

Retrieving region-specific standard video feeds

The API enables you to retrieve region-specific standard feeds by inserting a region ID in the feed URL. The following URL demonstrates the format of the URLs that you would use to retrieve region-specific standard feeds:

http://gdata.youtube.com/feeds/api/standardfeeds/regionID/feedID?v=2

For example, to retrieve a list of the top-rated videos in Japan, you would send a GET request to the following URL:

http://gdata.youtube.com/feeds/api/standardfeeds/JP/top_rated?v=2

The following tables identify the countries for which the YouTube Data API supports localized feeds and the regionID associated with each country:

Country Region ID
Argentina AR
Australia AU
Brazil BR
Canada CA
Czech Republic CZ
France FR
Germany DE
Great Britain GB
Hong Kong HK
India IN
Ireland IE
Israel IL
Italy IT
Country Region ID
Japan JP
Mexico MX
Netherlands NL
New Zealand NZ
Poland PL
Russia RU
South Africa ZA
South Korea KR
Spain ES
Sweden SE
Taiwan TW
United States US

Retrieving category-specific standard video feeds

The API also enables you to retrieve category-specific standard feeds by appending an underscore and a category name to the standard feed URL. The following URL demonstrates the format of the URLs that you would use to retrieve category-specific standard feeds:

https://gdata.youtube.com/feeds/api/standardfeeds/regionID/feedID_CATEGORY_NAME?v=2

For example, to retrieve a list of the top-rated comedies in Japan, you would send a GET request to the following URL:

https://gdata.youtube.com/feeds/api/standardfeeds/JP/top_rated_Comedy?v=2

Please note the following guidelines when generating URLs for category-based standard feeds:

  • The Category list for uploaded videos section explains how to retrieve the categories that could be used to classify video content. That section also explains how to identify the regions where each category is browsable.

  • If you retrieve a localized category list, the category name that you append to the URL is still the English word that is the value of the <atom:category> tag's term attribute in the category list.

    Category listing:
    <atom:category term='Entertainment' label='Divertissement' xml:lang='fr-FR'>
    
    URL for feed of top-rated entertainment videos in France:
    https://gdata.youtube.com/feeds/api/standardfeeds/FR/top_rated_Entertainment
    
  • The regionID in the feed URL is optional. If you do not specify a region ID, the API response will contain a category-based standard feed that is not restricted to a particular locale.

  • If your request does specify a regionID, then the specified category must be browsable in the specified region. For example, you can request a feed of the top-rated nonprofit videos in the United States because "Nonprofit" is a browsable category in the United States. However, you cannot request the top-rated nonprofit videos in France since "Nonprofit" is not a browsable category there.

Video responses

A video responses feed contains videos that have been explicitly designated as a response to another video. A video can be designated as a video response to exactly one other video, and some videos may not have any video responses.

Each video entry in an API response contains a series of <link> tags. The <link> tag that has a rel attribute value of http://gdata.youtube.com/schemas/2007/#video.responses identifies the URL for retrieving video responses for that video entry. (The <link> tag's href attribute identifies the URL as shown in the following example.)

<link rel="http://gdata.youtube.com/schemas/2007#video.responses"
     type="application/atom+xml"
     href="http://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/responses?v=2"/>

Related videos

This section explains how to retrieve a feed containing a list of videos that are related to another video. YouTube algorithmically selects the set of related videos.

Each video entry in an API response contains a series of <link> tags. The <link> tag that has a rel attribute value of http://gdata.youtube.com/schemas/2007/#video.related identifies the URL for retrieving other videos related to that video entry. (The <link> tag's href attribute identifies the URL.)

<link rel="http://gdata.youtube.com/schemas/2007#video.related"
     type="application/atom+xml"
     href="https://gdata.youtube.com/feeds/api/videos/ZTUVgYoeN_b/related?v=2"/>

The API response for this query has exactly the same format as the sample response in the Understanding video feeds and entries section of this documentation.

User's favorites feed

The favorite videos feed retrieves a list of videos that a particular user has explicitly flagged as a favorite video. On YouTube's website, a user can view and edit his list of favorite videos on his account page, and a user's favorite videos are also publicly visible to other YouTube users.

  • To request a feed of the currently logged-in user's favorite videos, send an HTTP GET request to the following URL. Note: For this request, you must provide an authentication token in the Authorization HTTP request header. The authentication token enables YouTube to identify the user.

    http://gdata.youtube.com/feeds/api/users/default/favorites?v=2
  • To request a feed of another user's favorite videos, send an HTTP GET request to the following URL. Note that this request does not require authentication.

    http://gdata.youtube.com/feeds/api/users/username/favorites?v=2

    In the URL above, you must replace the text username with the user's YouTube username.

By default, the favorites feed returns 25 entries at a time, and it returns a maximum of 50 entries at a time. We strongly recommend that you paginate the feed by using the start-index and max-results query parameters to optimize the response size and latency.

pagination links

« Previous
Displaying Video Information
Next »
Browsing with Categories and Keywords

Authentication required

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

Signing you in...

Google Developers needs your permission to do that.