YouTube

YouTube API v2.0 – Searching for Playlists

This section explains how to use the API to retrieve a list of playlists matching a user-specified search term. YouTube tries to match the search term to playlist names and descriptions as well as to the metadata fields for videos in each playlist. To search for playlists, send a GET request to the following URL:

https://gdata.youtube.com/feeds/api/playlists/snippets

YouTube supports the following API query parameters for playlist search:

Note: The q parameter value can contain multiple words, and it can also use the Boolean NOT (-) and OR (|) operators. However, playlist search requests do not support searches for an exact phrase, as described in the q parameter definition.

Sample playlist search request

The following API request searches for the second set of 10 playlists matching the query term "GoogleDevelopers":

https://gdata.youtube.com/feeds/api/playlists/snippets?
    q=GoogleDevelopers
    &start-index=11
    &max-results=10
    &v=2

This request yields the following response:

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:media='http://search.yahoo.com/mrss/' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:yt='http://gdata.youtube.com/schemas/2007' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/"DEAAQH44eip7ImA9WxVUGUQ."'>
  <id>tag:youtube.com,2008:playlists:snippets</id>
  <updated>2009-03-25T15:59:01.032Z</updated>
  <category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#playlistLink'/>
  <title>YouTube Playlists matching query: GoogleDevelopers</title>
  <logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>
  <link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/playlists/snippets?v=2'/>
  <link rel='http://schemas.google.com/g/2005#batch' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/playlists/snippets/batch?v=2'/>
  <link rel='self' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/playlists/snippets?q=GoogleDevelopers&start-index=1&max-results=25&v=2'/>
  <link rel='service' type='application/atomsvc+xml' href='https://gdata.youtube.com/feeds/api/playlists/snippets?alt=atom-service&v=2'/>
  <link rel='next' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/playlists/snippets?q=GoogleDevelopers&start-index=26&max-results=25&v=2'/>
  <author>
    <name>YouTube</name>
    <uri>http://www.youtube.com/</uri>
  </author>
  <generator version='2.0' uri='http://gdata.youtube.com/'>YouTube data API</generator>
  <openSearch:totalResults>5590</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>25</openSearch:itemsPerPage>
  <entry gd:etag='W/"D0ANRn47eCp7ImA9WxVUF04."'>
    <id>tag:youtube.com,2008:playlist:snippet: PL5D286BD1D14EAF40</id>
    <published>2008-05-26T23:39:53.000Z</published>
    <updated>2009-03-21T12:45:57.000Z</updated>
    <category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#playlistLink'/>
    <title>Google Data <b>APIs</b></title>
    <summary/>
    <content type='application/atom+xml;type=feed' src='https://gdata.youtube.com/feeds/api/playlists/PL5D286BD1D14EAF40?v=2'/>
    <link rel='related' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/users/GoogleDevelopers?v=2'/>
    <link rel='alternate' type='text/html' href='https://www.youtube.com/view_play_list?p= PL5D286BD1D14EAF40'/>
    <link rel='self' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/playlists/snippets/PL5D286BD1D14EAF40?v=2'/>
    <link rel='edit' type='application/atom+xml' href='https://gdata.youtube.com/feeds/api/playlists/snippets/PL5D286BD1D14EAF40?v=2'/>
    <author>
      <name>GoogleDevelopers</name>
      <uri>https://gdata.youtube.com/feeds/api/users/GoogleDevelopers</uri>
    </author>
    <yt:countHint>4</yt:countHint>
    <media:group>
      <media:thumbnail url="http://i.ytimg.com/vi/OOE9l23P7jg/default.jpg" height="90" width="120" yt:name="default"/>
      <media:thumbnail url="http://i.ytimg.com/vi/OOE9l23P7jg/mqdefault.jpg" height="180" width="320" yt:name="mqdefault"/>
      <media:thumbnail url="http://i.ytimg.com/vi/OOE9l23P7jg/hqdefault.jpg" height="360" width="480" yt:name="hqdefault"/>
    </media:group>
    <yt:playlistId> PL5D286BD1D14EAF40</yt:playlistId>
  </entry>
  <entry>
    ...
  </entry>
</feed>

Each entry in the response contains information about a YouTube playlist that matches the search request. Entries contain the following information:

  • The <title> and <summary> tags specify a name and description of the playlist, respectively. (Note that some playlists may not have a description, in which case the <summary> tag will be empty.)

  • The <author> tag identifies the owner of the playlist.

  • The <content> tag identifies the URL that you would use to retrieve a feed of the videos in the playlist.

  • The <link> tags contain links relevant to the playlist, including a link to retrieve the playlist owner's profile data through the API and a link to view the playlist on the YouTube website.

  • The <yt:playlistId> tag contains a value that YouTube uses to uniquely identify a playlist. You could use this value to add a subscription to the playlist.

  • The <yt:countHint> tag specifies the number of videos in the playlist.

pagination links

« Previous
Searching for Channels
Next »
Uploading 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.