Search code examples
apigdata

GDATA and youtube, Get all videos on a playlist


Does anyone know how to get all the videos from a playlist ?

E.g from this playlist

https://gdata.youtube.com/feeds/api/playlists/454A0274C1223C90?v=2

it caps at 10 results

I tried &max-results=1000 but that 404'ed


Solution

  • try asking for 50 results at a time ( max allowed )

    GET /feeds/api/playlists/454A0274C1223C90?v=2&&max-results=100&fields=entry/id,entry/title&key=4{your-key} HTTP/1.1
    Host: gdata.youtube.com
    Authorization: OAuth ya29.AHES6ZQMwDjrUKh8RLysv-ZzF3DaUmg0XmG0jtVcWdSA0A
    HTTP/1.1 400 Bad Request
    status: 400
    content-length: 246
    x-xss-protection: 1; mode=block
    x-content-type-options: nosniff
    expires: Sat, 28 Apr 2012 16:29:01 GMT
    x-google-cache-control: remote-fetch
    server: GSE
    via: HTTP/1.1 GWA
    x-gdata-user-country: US
    cache-control: private, max-age=0
    date: Sat, 28 Apr 2012 16:29:01 GMT
    x-frame-options: SAMEORIGIN
    content-type: application/vnd.google.gdata.error+xml
    -content-encoding: gzip
    <errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>InvalidRequestUriException</code><internalReason>Max-results value is too high. Only up to 50 results can be returned per query.
    
    
    GET /feeds/api/playlists/454A0274C1223C90?v=2&&max-results=50&fields=entry/id,entry/title&key=${key} HTTP/1.1
    Host: gdata.youtube.com
    Authorization: OAuth ya29.AHES6ZQMwDjrUKh8RLysv-ZzF3DaUmg0XmG0jtVcWdSA0A
    HTTP/1.1 200 OK
    status: 200
    gdata-version: 2.1
    content-length: 6703
    via: HTTP/1.1 GWA
    content-location: https://gdata.youtube.com/feeds/api/playlists/454A0274C1223C90?v=2&&max-results=50&fields=entry/id,entry/title&key=w1Q
    x-content-type-options: nosniff
    expires: Sat, 28 Apr 2012 16:32:08 GMT
    vary: Accept, X-GData-Authorization, GData-Version
    x-google-cache-control: remote-fetch
    server: GSE
    last-modified: Sat, 28 Apr 2012 10:46:07 GMT
    x-xss-protection: 1; mode=block
    etag: W/"A04CRn47eCp7I2A9WhVWFk0."
    cache-control: private, max-age=300, no-transform
    date: Sat, 28 Apr 2012 16:32:08 GMT
    x-frame-options: SAMEORIGIN
    content-type: application/atom+xml; charset=UTF-8; type=feed
    -content-encoding: gzip
    x-gdata-user-country: US