YouTube API v2.0 – Displaying a List of Videos

Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information. Please use the YouTube Data API (v3) for new integrations and migrate applications still using the v2 API to the v3 API as well.

The following screenshot demonstrates how YouTube displays information in a video list. The screenshot is annotated, and the list following the screenshot explains how the display elements correspond to the information in an API response.

The screenshot displays the following information:

  1. This element displays a title for the result set. In your application, this value could be the value of the <title> tag or you could select other text appropriate to the requested feed or search result set.

  2. In this text, the number 15 would be taken from the <openSearch:totalResults> tag. Please note that the value of this tag is an approximation of the total number of results and not necessarily an exact figure.

    If you wanted to also identify which items from the feed were being displayed – e.g. items 1 to 10 – you would also use the values of the <openSearch:startIndex> and <openSearch:itemsPerPage> tags.

  3. The Sort by menu lets the user select a value for the orderby query parameter. A pulldown menu showing how results are sorted also appears on the right side of the image, below the result count.

    The Filter options let the user set values for a number of other search parameters, including the time, 3d, caption, duration, hd, license, paid-content, and uploader parameters. It also displays options to display either channel or playlist search results.

    The API Query Parameters section provides a complete list of the query parameters that the YouTube Data API supports and explains the types of queries for which each parameter applies.

  4. This sorting menu also lets the user select a value for the orderby query parameter.

  5. This element displays a thumbnail image of the video. YouTube API responses may contain multiple thumbnail images for a video, each of which is identified by a <media:thumbnail> tag. The video duration also displays in the bottom right corner of the thumbnail image. The <yt:duration> specifies this value.

    On the YouTube website, the thumbnail image links to the watch page for the video. That page displays more information about the video as well as comments and rating information. In a video entry, the <link> tag that has a rel attribute value of alternate identifies the URL for the YouTube page where the user could watch the video. You could also use the video's <yt:videoid> to construct the URL or to play the video using an embedded (or chromeless) YouTube player.

    On YouTube search result pages, thumbnail images link to that URL.

  6. The title next to the thumbnail image is the value of the <media:title> tag for that video.

  7. The snippet below the title shows parts of the video description, which is the value of the <media:description> tag.

  8. The text and buttons below the video description show values from a number of tags:

    • The byline, which identifies the video uploader, shows the value of the <name> tag.
    • The time indicated in each result is calculated based on the value of the <published> tag for the video.
    • The view count is taken from the <yt:statistics> tag's viewCount attribute.
    • In the third result, the HD text indicates that the <yt:hd> is in the video entry.

To retrieve a feed entry for a single video in the result set, you would submit an HTTP GET request to the edit URL for that entry, as explained in the following section. For example, you might issue this request if the user links from a set of search results to a video watch page that only displays information about the selected video.

pagination links

« Previous
Understanding Video Feeds and Entries
Next »
Identifying Related Feeds