YoutubeExplode: GetPlaylistAsync() doesn't return all videos

When getting a playlist (in my case it was a big playlist, 1124 videos), not all videos are returned. The missing videos are always the last in the playlist.

Looks like YoutubeExplode is using youtube.com/list_ajax and not the v3 playlist API, the issue could be on Youtube’s side.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 31 (15 by maintainers)

Most upvoted comments

Actually I’ve never used C# before so I’ll leave that to you.😛 You can ask me if you need help with anything though.

Just keep in mind that it always wants to return 200 videos. A playlist with 350 videos would also work if you increase the index by 200 (index=101 gives 1-200, index=301 gives 151-350), but for example 250 videos wouldn’t work since you’re skipping over the rest (index=101 gives 1-200, index=301 gives 1-200). With increments of 100 you’re never skipping over anything.

Of course the most efficient solution would be to get 200 videos at a time. But I guess you haven’t discovered a way to get the size of a playlist from somewhere? (Maybe you can let the user enter it manually.)

I figured out how list_ajax works for another project I did.

Basically it selects from the middle and will always return an array with 200 videos.

So index=101 will get videos 1-200, index=301 will get 201-400, index=501 will get 401-600 etc.

The problem that remains is how to get the leftover videos (assuming the playlist isn’t a multiple of 200). If you set the index to the last video it will return the last 200 videos, but if you set the index to a number higher than the last video it will return videos 1-200 again.

This would be easy if you can get the playlist size from somewhere but I haven’t found anything yet. Maybe someone here has an idea?

Hope this helps.