Search
Clear search
Close search
Google apps
Main menu
true

Manage playlists

The YouTube XML format is being replaced by DDEX (music only) and CSV templates (all industries). YouTube strongly discourages any new implementations of the YouTube XML format. This page should be used solely as reference material for existing implementations. Visit Using the YouTube DDEX feed for more information about the new format.
The features described in this article are available only to partners who use YouTube's Content Manager to manage their copyrighted content.

A playlist is a collection of videos that can be viewed sequentially and shared with other users. The same video can be included in multiple playlists.

A <playlist> tag identifies a playlist that you want to create, update, or delete. The following sections show different types of operations that you can perform for playlists.

Creating a playlist

The following example demonstrates how to create a playlist. The <name> tag inside of the <playlist> tag specifies the playlist name, and the <item> tags identify the videos that are being added to the playlist. Each <item> tag specifies a value for the index attribute, which indicates where the video appears in the playlist.


    <playlist>
      <name>Comedy highlights</name>
      <item path="/external/video[@id='VIDEO_ID_1_']"/>
      <item path="/external/video[@id='VIDEO_ID_2_']"/>
      <item path="/external/video[@id='VIDEO_ID_3_']"/>
    </playlist>

The example above uses a number of default playlist settings. As such, if you include this excerpt in a feed (with valid video IDs), you will see the following behavior:

  • Since the <playlist> tag does not specify a value for its channel attribute, the playlist will be created in the default YouTube user account identified for your content owner. If you specify a value for the channel attribute, then the playlist will be created in that channel instead. (The channel must be linked to your content owner.)

  • Since the <item> tags do not specify values for the index attribute, the videos will be added to the playlist in the order that they appear in the feed.

  • Since none of the <item> tags contain the icon attribute (with a value of True), a thumbnail image from the first video in the playlist will be used as the playlist's icon. If you do set the icon attribute to True for one of the videos in the playlist, then that video will automatically appear first in the playlist, regardless of any other ordering instructions that you include for the playlist videos.

In addition, note that this example specifies a playlist name of "Comedy highlights". If your channel already contained a playlist with that name, then the request above would create a second playlist with the same name.

Updating items in a playlist

The following XML demonstrates how to add an additional video to the playlist created in the previous section:


   <playlist id="PL586D322B5E2764CF">
      <item path="/external/video[@id='VIDEO_ID_4_']"/>
    </playlist>

To reorder the videos in a playlist, use the <item> tag's index attribute to explicitly specify the order in which the videos should appear. The following XML updates the playlist created in the previous section so that instead of having videos appear in 1-2-3-4 order, they appear in 3-1-4-2 order. (The third video has an index value of 1, the first video has an index value of 2, and so forth.)


 <playlist id="PL586D322B5E2764CF">
      <item index="1" path="/external/video[@id='VIDEO_ID_3_']"/>
      <item index="2" path="/external/video[@id='VIDEO_ID_1_']"/>
      <item index="3" path="/external/video[@id='VIDEO_ID_4_']"/>
      <item index="4" path="/external/video[@id='VIDEO_ID_2_']"/>
   </playlist>

The example below reorders the videos in the same way, but it uses the icon attribute to indicate that the third video appears first in the playlist. The icon attribute value supersedes the other ordering instructions for the playlist items:


<playlist id="PL586D322B5E2764CF">
      <item icon="True" path="/external/video[@id='VIDEO_ID_3_']"/>
      <item index="2" path="/external/video[@id='VIDEO_ID_1_']"/>
      <item index="3" path="/external/video[@id='VIDEO_ID_4_']"/>
      <item index="4" path="/external/video[@id='VIDEO_ID_2_']"/>
    </playlist>

To remove a video from a playlist, set the action attribute value to delete for that item. The example below removes the fourth video from the playlist:


  <playlist id="PL586D322B5E2764CF">
      <item action="delete" path="/external/video[@id='VIDEO_ID_4_']"/>
   </playlist>
Renaming a playlist

This example uses the <playlist> tag's id attribute to identify the playlist being updated, and the <name> tag to provide the new playlist name.


  <playlist id="PL586D322B5E2764CF">
     <name>Playlist's new name</name>
  </playlist>
Setting a playlist as a series playlist

To make a playlist a series playlist, set the <playlist> tag's series attribute value to True for that playlist. By default, playlists are not created as series playlists, and if you do not specify a value for the series attribute, then YouTube will not update the playlist's existing state.

The following XML updates the playlist created in the example above into a series playlist:


<playlist series="True"/>
    <name>Comedy highlights</name>
</playlist>
Was this article helpful?
How can we improve it?
Resources for Creators

Check out the creator resources available to help you build your channel and connect with the community.