diff --git a/CHANGELOG b/CHANGELOG index 358b01a7..a42495cd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - Report scraper progress in a JSON file specified with `--stats-filename` (#228) +- Fix main playlist selection to respect the order of provided playlist IDs (#286) ## [3.0.1] - 2024-08-13 diff --git a/scraper/src/youtube2zim/youtube.py b/scraper/src/youtube2zim/youtube.py index f9cd6909..f5c64093 100644 --- a/scraper/src/youtube2zim/youtube.py +++ b/scraper/src/youtube2zim/youtube.py @@ -345,7 +345,8 @@ def extract_playlists_details_from(collection_type, youtube_id): raise NotImplementedError("unsupported collection_type") return ( - [Playlist.from_id(playlist_id) for playlist_id in list(set(playlist_ids))], + # dict.fromkeys maintains the order of playlist_ids while removing duplicates + [Playlist.from_id(playlist_id) for playlist_id in dict.fromkeys(playlist_ids)], main_channel_id, uploads_playlist_id, )