mirror of
https://github.com/l1ving/youtube-dl
synced 2025-01-24 14:03:02 +08:00
add reverse order feature
This commit is contained in:
parent
561504fffa
commit
552c435360
12
youtube-dl
12
youtube-dl
@ -2547,7 +2547,12 @@ class YoutubePlaylistIE(InfoExtractor):
|
||||
|
||||
playliststart = self._downloader.params.get('playliststart', 1) - 1
|
||||
playlistend = self._downloader.params.get('playlistend', -1)
|
||||
reverseorder = self._downloader.params.get('reverseorder', True)
|
||||
|
||||
video_ids = video_ids[playliststart:playlistend]
|
||||
|
||||
if reverseorder:
|
||||
video_ids.reverse()
|
||||
|
||||
for id in video_ids:
|
||||
self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % id)
|
||||
@ -2629,6 +2634,7 @@ class YoutubeUserIE(InfoExtractor):
|
||||
all_ids_count = len(video_ids)
|
||||
playliststart = self._downloader.params.get('playliststart', 1) - 1
|
||||
playlistend = self._downloader.params.get('playlistend', -1)
|
||||
reverseorder = self._downloader.params.get('reverseorder', True)
|
||||
|
||||
if playlistend == -1:
|
||||
video_ids = video_ids[playliststart:]
|
||||
@ -2637,6 +2643,9 @@ class YoutubeUserIE(InfoExtractor):
|
||||
|
||||
self._downloader.to_screen("[youtube] user %s: Collected %d video ids (downloading %d of them)" %
|
||||
(username, all_ids_count, len(video_ids)))
|
||||
|
||||
if reverseorder:
|
||||
video_ids.reverse()
|
||||
|
||||
for video_id in video_ids:
|
||||
self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % video_id)
|
||||
@ -4161,7 +4170,8 @@ def parseOpts():
|
||||
dest='playliststart', metavar='NUMBER', help='playlist video to start at (default is 1)', default=1)
|
||||
selection.add_option('--playlist-end',
|
||||
dest='playlistend', metavar='NUMBER', help='playlist video to end at (default is last)', default=-1)
|
||||
selection.add_option('--match-title', dest='matchtitle', metavar='REGEX',help='download only matching titles (regex or caseless sub-string)')
|
||||
selection.add_option('--reverse-order', action='store_true', dest='reverseorder', help='reverse download order for user pages/playlists', default=False)
|
||||
selection.add_option('--match-title', action='store_true', dest='matchtitle', metavar='REGEX', help='download only matching titles (regex or caseless sub-string)')
|
||||
selection.add_option('--reject-title', dest='rejecttitle', metavar='REGEX',help='skip download for matching titles (regex or caseless sub-string)')
|
||||
selection.add_option('--max-downloads', metavar='NUMBER', dest='max_downloads', help='Abort after downloading NUMBER files', default=None)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user