Fix issue for limitting number of playlist entry downloads

created_at doesn't seem to be present in the MiniTrack class, but id will always
be present and works equally well.
master
Christof Damian 2021-12-13 11:47:02 +01:00
parent 8f6ac3a8f7
commit 3a6529c65b
1 changed files with 1 additions and 1 deletions

View File

@ -395,7 +395,7 @@ def download_playlist(client: SoundCloud, playlist: BasicAlbumPlaylist, **kwargs
try:
if kwargs.get("n"): # Order by creation date and get the n lasts tracks
playlist.tracks.sort(
key=lambda track: track.created_at, reverse=True
key=lambda track: track.id, reverse=True
)
playlist.tracks = playlist.tracks[: int(kwargs.get("n"))]
else: