YouTube

YouTube API v2.0 – Displaying Video Information

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 annotated screenshot below shows a YouTube video watch page, which primarily displays information about a single video. The list following the screenshot explains how to use the YouTube API to retrieve the information. Note that you would need to synthesize content from several API responses to reproduce this page using the API.

To display this page, you would first retrieve the feed for the video entry. The XML in a video entry feed is identical to the content that appears for that video in a feed or search result set. As shown above, this page also includes information from the video's comments feed and related videos feed. In addition, the pulldown menu below the video title shows information from the video owner's uploaded videos feed.

The screenshot displays the following information:

  1. This item shows the title of the video. In a video entry, the <media:title> tag contains the video's title.

  2. The Subscribe button next to the video owner's name (or channel icon) allows a user to subscribe to the video owner's activity feed.

    The pulldown menu next to the button shows information from the video owner's uploaded videos feed. The pulldown shows the number of videos that the video owner has uploaded. This value is specified in the <openSearch:totalResults> tag.

    When a user clicks on the pulldown, the pane shown below appears, displaying other videos uploaded by the video owner. Each video corresponds to an entry in the uploaded videos feed. For each video, the pane shows a thumbnail image (<media:thumbnail>), the video duration (<yt:duration>), the video title (<media:title>, the video owner (<name>), and the video's view count (<yt:statistics>).

  3. This item shows a video player. The Embedded player parameters document explains how to customize a YouTube embedded player in your own application. In addition, the <iframe> Player API Reference, the ActionScript 3.0 Player API Reference, and the JavaScript Player API Reference all explain how to build a chromeless player that uses your own custom controls.

  4. This section displays the video's upload date (<published>), description (<media:description>), view count (<yt:statistics>), and rating (<gd:rating>).

    This section also displays buttons for the user to rate the video, add the video to a playlist or "watch later" list, mark the video as a favorite, or flag the video for inappropriate content.

  5. This section displays a list of comments for the video. In the video entry, the <gd:feedLink> tag that has a rel attribute value of http://gdata.youtube.com/schemas/2007#comments specifies the number of comments on the video as well as the URL for the video's comments feed. You would need to retrieve that feed to actually display the comments.

  6. This section displays a list of videos that YouTube considers similar to the video featured on the page. The related videos feed allows you to retrieve this list using the API.

  7. pagination links

    « Previous
    Identifying Related Feeds
    Next »
    Retrieving and Searching for Videos

Authentication required

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

Signing you in...

Google Developers needs your permission to do that.