Ahmed Karmous
Ahmed Karmous

Reputation: 373

Youtube api retrieve certain playlist items

I'm using youtube api to get videos from a playlist :

GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PL2MJN9x8D1E74fQH39DPaKP2b6SBMpeBi&key={YOUR_API_KEY}

what i want to know ! is there a way to use publishedAt filter to this api to get videos that where published after certain date ?

Upvotes: 0

Views: 376

Answers (1)

Joe
Joe

Reputation: 706

The publishedAt getting returned from a Playlist query is the date the video was added to the playlist, rather than the date the video was published on YouTube.

For example, the first two items in the playlist say:

"publishedAt": "2015-03-14T14:39:51.000Z" "publishedAt": "2015-03-14T14:40:20.000Z"

You may need to loop through the results and do another request (can use multiple URL-encoded, comma-separated ids to save requests) on each videoId to get the actual published dates

GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=etAIpkdhU9Q%2CLo2qQmj0_h4&key={YOUR_API_KEY}

"publishedAt": "2013-03-08T11:15:44.000Z" "publishedAt": "2013-03-11T07:00:41.000Z"

Upvotes: 1

Related Questions