]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/__init__.py
Add slicing notation to `--playlist-items`
[yt-dlp.git] / yt_dlp / __init__.py
index 73ef03662c26b400e118a5c88801cac76c69a49c..1538a7e89608ec7d457a2870a6200a75fc391cf1 100644 (file)
@@ -33,6 +33,7 @@
     DownloadCancelled,
     DownloadError,
     GeoUtils,
+    PlaylistEntries,
     SameFileError,
     decodeOption,
     download_range_func,
@@ -372,6 +373,12 @@ def metadataparser_actions(f):
     opts.parse_metadata = list(itertools.chain(*map(metadataparser_actions, parse_metadata)))
 
     # Other options
+    if opts.playlist_items is not None:
+        try:
+            tuple(PlaylistEntries.parse_playlist_items(opts.playlist_items))
+        except Exception as err:
+            raise ValueError(f'Invalid playlist-items {opts.playlist_items!r}: {err}')
+
     geo_bypass_code = opts.geo_bypass_ip_block or opts.geo_bypass_country
     if geo_bypass_code is not None:
         try: