How get all videos from a playlist using youtube api?

前端 未结 2 2010
情歌与酒
情歌与酒 2020-12-28 21:51

Now i am using this link

http://gdata.youtube.com/feeds/api/playlists/plalistID

to retrieve video from YouTube playlist. but the problem is

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-28 22:25

    YouTube API v3

    You need to request the PlaylistItems > list feed:

    https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId=PLVfin74Qx3tV8bgAhzbfDpnfPoGmJWAcn&key=YOUR_API_KEY
    

    The JSON returned by the API will contain these properties:

    • nextPageToken
    • prevPageToken

    Pass one of these values in the pageToken query string parameter to retrieve the next or previous "page" in the result set:

    https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=25&playlistId=PLVfin74Qx3tV8bgAhzbfDpnfPoGmJWAcn&pageToken=xxYYzz&key=YOUR_API_KEY
    

    The JSON also contains pageInfo.resultsPerPage and pageInfo.totalResults properties.


    YouTube API v2 answer is here.

提交回复
热议问题