Hexer10 / youtube_explode_dart

Dart library to interact with many Youtube APIs
https://pub.dev/packages/youtube_explode_dart
BSD 3-Clause "New" or "Revised" License
299 stars 122 forks source link

[BUG] Working with playlist with more than 120 videos #261

Closed tihrasguinho closed 9 months ago

tihrasguinho commented 9 months ago

Describe the bug I discovered that when I try to get some playlists the stream never closes, putting a print inside the await for of Stream I discovered that the stream goes up to 120 events, after that nothing happens and the stream doesn't close, the only way I found to working with this was getting the first 120 with the .take(120) method!

To Reproduce I tried both ways, using the await for method and stream.listen, both cause the same bug!

final videos = yt.playlists.getVideos(playlistId).take(120);

final songs = <SongModel>[
  await for (final video in videos)
    SongModel(
      id: video.id.value,
      title: video.title,
      image: video.thumbnails.highResUrl,
      genres: genres,
      createdAt: DateTime.now(),
    )
];

Enviroment:

Hexer10 commented 9 months ago

I was able to to fetch up to ~700 videos from several playlists, can you provide a playlist id that has such issue?

tihrasguinho commented 9 months ago

I forgot to mention, but the playlists I was using were from YouTube Music, which until then worked but always stopped at index 120 and after that nothing else happened and the stream never closes.

Playlist ID: RDCLAK5uy_m9Rw_g5eCJtMhuRgP1eqU3H-XW7UL6uWQ

This playlist has 124 songs but when I try to get all the songs, the stream stops after index 120

Edit: I have the same problem with other playlists (same YouTube music playlists), but only when there are more than 120 songs, playlists that have less than 120 songs work normally!

Hexer10 commented 9 months ago

@tihrasguinho thanks for providing a playlist id, I just tried to fetch the videos using the library and I couldn't get even one video, where as if I open the playlist page ( https://www.youtube.com/playlist?list=RDCLAK5uy_m9Rw_g5eCJtMhuRgP1eqU3H-XW7UL6uWQ ) while being logged in I can see al the videos, but if I'm not logged youtube displays that the playlist does not exist.

I tryed fetching the playlist with ytdl and I was able to fetch it successfully, so, some playlists require a particular method to be properly fetched.

Hexer10 commented 9 months ago

I'll leave this open since I'm still working on fix for this issue