mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-07 06:57:19 +08:00
Add --playlist-title-end option to end video selection at a given video's title.
Signed-off-by: Liav Rehana <liavrehana@gmail.com>
This commit is contained in:
parent
00eb865b3c
commit
d7d2d98dae
@ -978,7 +978,12 @@ class YoutubeDL(object):
|
||||
|
||||
x_forwarded_for = ie_result.get('__x_forwarded_for_ip')
|
||||
|
||||
playlist_title_end = self.params.get('playlisttitleend')
|
||||
for i, entry in enumerate(entries, 1):
|
||||
if playlist_title_end is not None:
|
||||
if entry['title'] == playlist_title_end:
|
||||
self.to_screen('[download] Stopping at video %s' % (playlist_title_end))
|
||||
break
|
||||
self.to_screen('[download] Downloading video %s of %s' % (i, n_entries))
|
||||
# This __x_forwarded_for_ip thing is a bit ugly but requires
|
||||
# minimal changes
|
||||
|
@ -359,6 +359,7 @@ def _real_main(argv=None):
|
||||
'progress_with_newline': opts.progress_with_newline,
|
||||
'playliststart': opts.playliststart,
|
||||
'playlistend': opts.playlistend,
|
||||
'playlisttitleend': opts.playlisttitleend,
|
||||
'playlistreverse': opts.playlist_reverse,
|
||||
'playlistrandom': opts.playlist_random,
|
||||
'noplaylist': opts.noplaylist,
|
||||
|
@ -263,6 +263,10 @@ def parseOpts(overrideArguments=None):
|
||||
'--playlist-end',
|
||||
dest='playlistend', metavar='NUMBER', default=None, type=int,
|
||||
help='Playlist video to end at (default is last)')
|
||||
selection.add_option(
|
||||
'--playlist-title-end',
|
||||
dest='playlisttitleend', metavar='STRING', default=None, type=str,
|
||||
help='Playlist video title to end at (default is None)')
|
||||
selection.add_option(
|
||||
'--playlist-items',
|
||||
dest='playlist_items', metavar='ITEM_SPEC', default=None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user