YouTube API v2.0 - Retrieving Live Events

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.

Note: The API's functionality for retrieving live events has been deprecated as of February 26, 2014. This functionality was explicitly excluded from the API features subject to the Deprecation Policy.

Please use the YouTube Live Streaming API for applications that create or manage live broadcasts on YouTube.

A live-streaming event is an event that is broadcast on YouTube as it occurs. The API uses the following feeds and entries to return information about live-streaming events:

  • An event feed contains a list of live-streaming events created by a specific user. An event feed comprises a series of event entries.

  • An event entry contains metadata about a single live-streaming event, such as the event's name, description, start time, and status. An event entry is currently associated with a single live video entry; however, a single event may eventually be associated with multiple live video entries.

  • A live video entry contains information about a live video stream of an event. A live video entry is an extension of the video entry, which is used in other types of video feeds, including search feeds, uploads, and so forth. A live video entry may also contain additional tags that would be used to convey information about a live video stream but that would not be relevant to other videos, such as information about the content delivery network used to stream the content.

    If a video entry refers to a live video, the entry will contain a <category> tag with a scheme attribute value of http://schemas.google.com/g/2005#kind and a term attribute value of http://gdata.youtube.com/schemas/2007#liveVideo.

The following sections explain different options for retrieving live-streaming events:

  1. Live event charts
  2. Retrieving a user's events feed
  3. Retrieving a single live event

Live event charts

You can retrieve several different standard feeds, or charts, listing live events on YouTube.

To retrieve a live event chart, send a GET request to the URL associated with that chart. Note that you must be using version 2 of the YouTube API to retrieve any of these charts. You can specify the API version using either the v parameter or the GData-Version HTTP request header.

The following table describes the charts that you can retrieve and identifies the URL associated with each chart:

Chart name Feed ID URL and Description
Featured live events featured URL: https://gdata.youtube.com/feeds/api/charts/live/events/featured
Description: This feed lists promoted live events that are currently happening or will soon take place.
Current live events live_now URL: https://gdata.youtube.com/feeds/api/charts/live/events/live_now
Description: This feed lists live events that are currently active.
Upcoming live events upcoming URL: https://gdata.youtube.com/feeds/api/charts/live/events/upcoming
Description: This feed lists events that will take place within the time frame specified for the time parameter. Valid parameter values are today (one day), this_week (seven days), this_month (one month), and all_time, and all_time is the default value.
Recently broadcast recently_broadcasted URL: https://gdata.youtube.com/feeds/api/charts/live/events/recently_broadcasted
Description: This feed lists events that recently ended.

API requests to retrieve live event charts can specify any of the following parameters:

  • The region parameter filters a chart to only include live events that are featured within the specified region.

Retrieving a user's events feed

This section explains how to retrieve a feed listing a specific user's live-streaming events. Note that YouTube has not enabled all user accounts to create and stream live events. If a user has not created any live-streaming events or is not allowed to create live-streaming events, that user's events feed will not contain any entries.

  • To request a feed of the currently logged-in user's live-streaming events, 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.

  • To request a feed of another user's live-streaming events, send an HTTP GET request to the following URL. Note that this request does not require authentication.


    In the URL above, you should replace the text userId with the user's YouTube user ID. For backward compatibility purposes, the API also supports having the user's YouTube username specified instead.

Determining whether a user can create live events

If a user can create live events, then the user's profile entry will contain a <gd:feedLink> that points to the user's events feed. The tag will have the following attributes:

  • The rel attribute value will be http://gdata.youtube.com/schemas/2007#user.live.
  • The href attribute value will specify the URL of the user's events feed.
  • The countHint attribute value will specify the number of events in the feed.

The XML below shows a sample <gd:feedLink> tag:

<gd:feedLink rel='http://gdata.youtube.com/schemas/2007#user.live'

Special query parameters for retrieving live events

YouTube supports the following API query parameters specifically for requests to retrieve live event feeds:

  • status – The API response will only include events that are either pending (not yet started), active (in progress), completed, cancelled, or rejected.
  • starts-before – The API response will only include events that started before (or will start before) the given date and time.
  • starts-after – The API response will only include events that started after (or will start after) the given date and time.
  • ends-before – The API response will only include events that ended before (or will end before) the given date and time.
  • ends-after – The API response will only include events that ended after (or will end after) the given date and time.

In addition, you can use the inline parameter to indicate that each entry in a live events feed should, in turn, contain an entry that points to the actual video content associated with the event. For example, the live event entry could contain a video entry if there is a single video stream associated with the event, or it could contain a playlist entry if there are multiple videos associated with the event.

  • If you set the inline parameter to true, the <content> tag in each event feed entry will encapsulate a video or playlist entry containing details about the video(s) associated with the event.

  • If you do not set the inline parameter or you set the parameter's value to false, the <content> tag in each event feed entry will contain a src attribute that points to the URL you would use to retrieve information about the video.

    If you do set the inline parameter to true, you may find it helpful to use the partial response feature to limit the size of the API response.

Sample live events feed

The following API request retrieves the live events for the YouTube user ytatestuser. Since the inline parameter is set to true, each entry's <content> tag will encapsulate the video entry associated with the event.


The following XML shows the API response for this request. The feed contains a series of <entry> tags, with each entry describing a live event. Each entry contains the title, description, author, date, and status of an event, among other fields. (Note that only the first entry is displayed below.)

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
  <category scheme='http://schemas.google.com/g/2005#kind'
  <link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml'
  <link rel='http://schemas.google.com/g/2005#post' type='application/atom+xml'
  <link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml'
  <link rel='self' type='application/atom+xml'
  <link rel='service' type='application/atomsvc+xml'
  <generator version='2.0' uri='http://gdata.youtube.com/'>YouTube data API</generator>

    <category scheme='http://schemas.google.com/g/2005#kind'
    <title>Test Event</title>
    <summary>Testing live streaming.</summary>
    <content type='application/atom+xml'>

          <yt:state name='processing'/>
        <category scheme='http://schemas.google.com/g/2005#kind'
        <category scheme='http://gdata.youtube.com/schemas/2007/categories.cat'
            term='Entertainment' label='Entertainment'/>
        <category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat'
        <title>Test Event</title>
        <link rel='alternate' type='text/html'
        <link rel='http://gdata.youtube.com/schemas/2007#video.responses' type='application/atom+xml'
        <link rel='http://gdata.youtube.com/schemas/2007#video.ratings' type='application/atom+xml'
        <link rel='http://gdata.youtube.com/schemas/2007#video.complaints' type='application/atom+xml'
        <link rel='http://gdata.youtube.com/schemas/2007#video.related' type='application/atom+xml'
        <link rel='http://gdata.youtube.com/schemas/2007#video.captionTracks' type='application/atom+xml'
        <link rel='http://gdata.youtube.com/schemas/2007#insight.views'
        <yt:accessControl action='comment' permission='allowed'/>
        <yt:accessControl action='commentVote' permission='allowed'/>
        <yt:accessControl action='rate' permission='allowed'/>
        <yt:accessControl action='embed' permission='allowed'/>
        <yt:accessControl action='list' permission='allowed'/>
        <yt:accessControl action='syndicate' permission='allowed'/>
          <gd:feedLink href='https://gdata.youtube.com/feeds/api/videos/BM7FWtADD0s/comments?v=2'
          <media:category label='Entertainment'
          <media:content url='http://www.youtube.com/v/BM7FWtADD0s?f=videos&app=youtube_gdata'
              type='application/x-shockwave-flash' medium='video' isDefault='true'
              expression='full' duration='0' yt:format='5'/>
          <media:credit role='uploader' scheme='urn:youtube'
          <media:description type='plain'>Testing live streaming.</media:description>
          <media:player url='https://www.youtube.com/watch?v=BM7FWtADD0s&feature=youtube_gdata_player'/>
          <media:restriction type='country'
              relationship='deny'>FR DE SE</media:restriction>
          <media:thumbnail url='http://i.ytimg.com/vi/BM7FWtADD0s/default.jpg'
              height='90' width='120' time='00:00:00' yt:name='default'/>
          <media:thumbnail url='http://i.ytimg.com/vi/BM7FWtADD0s/hqdefault.jpg'
              height='360' width='480' yt:name='hqdefault'/>
          <media:thumbnail url='http://i.ytimg.com/vi/BM7FWtADD0s/mqdefault.jpg'
              height='180' width='320' yt:name='mqdefault'/>
          <media:thumbnail url='http://i.ytimg.com/vi/BM7FWtADD0s/1.jpg'
              height='90' width='120' time='00:00:00' yt:name='start'/>
          <media:thumbnail url='http://i.ytimg.com/vi/BM7FWtADD0s/2.jpg'
              height='90' width='120' time='00:00:00' yt:name='middle'/>
          <media:thumbnail url='http://i.ytimg.com/vi/BM7FWtADD0s/3.jpg'
              height='90' width='120' time='00:00:00' yt:name='end'/>
          <media:title type='plain'>Test Event</media:title>
          <yt:duration seconds='0'/>

    <link rel='http://gdata.youtube.com/schemas/2007#video'
    <link rel='self' type='application/atom+xml'
    <link rel='edit' type='application/atom+xml'
      <media:description type='plain'>Testing live streaming.</media:description>
      <media:title type='plain'>Test Event</media:title>
    <yt:when start='2011-06-24T00:00:00.000Z'/>


Retrieving a single live event

There are two ways to obtain the API URL from which you would request information about a single live event:

  • In an event feed entry, the <link> tag that has a rel attribute value of self specifies the URL from which you would retrieve that same entry via the API. When retrieving a live event entry, you can use the inline parameter in the same way that you would use it when requesting a live events feed.

  • If a video entry contains a <link> tag for which the rel attribute value is http://gdata.youtube.com/schemas/2007#live.event, then the video is associated with a live event. The tag's href attribute value will specify the API URL that you would use to retrieve information about the event itself.

pagination links

« Previous
Messages and Video Sharing
Next »
Managing Live Events