mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-04-20 14:04:50 +09:00
add reverse order feature
This commit is contained in:
parent
561504fffa
commit
552c435360
12
youtube-dl
12
youtube-dl
@ -2547,8 +2547,13 @@ class YoutubePlaylistIE(InfoExtractor):
|
|||||||
|
|
||||||
playliststart = self._downloader.params.get('playliststart', 1) - 1
|
playliststart = self._downloader.params.get('playliststart', 1) - 1
|
||||||
playlistend = self._downloader.params.get('playlistend', -1)
|
playlistend = self._downloader.params.get('playlistend', -1)
|
||||||
|
reverseorder = self._downloader.params.get('reverseorder', True)
|
||||||
|
|
||||||
video_ids = video_ids[playliststart:playlistend]
|
video_ids = video_ids[playliststart:playlistend]
|
||||||
|
|
||||||
|
if reverseorder:
|
||||||
|
video_ids.reverse()
|
||||||
|
|
||||||
for id in video_ids:
|
for id in video_ids:
|
||||||
self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % id)
|
self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % id)
|
||||||
return
|
return
|
||||||
@ -2629,6 +2634,7 @@ class YoutubeUserIE(InfoExtractor):
|
|||||||
all_ids_count = len(video_ids)
|
all_ids_count = len(video_ids)
|
||||||
playliststart = self._downloader.params.get('playliststart', 1) - 1
|
playliststart = self._downloader.params.get('playliststart', 1) - 1
|
||||||
playlistend = self._downloader.params.get('playlistend', -1)
|
playlistend = self._downloader.params.get('playlistend', -1)
|
||||||
|
reverseorder = self._downloader.params.get('reverseorder', True)
|
||||||
|
|
||||||
if playlistend == -1:
|
if playlistend == -1:
|
||||||
video_ids = video_ids[playliststart:]
|
video_ids = video_ids[playliststart:]
|
||||||
@ -2638,6 +2644,9 @@ class YoutubeUserIE(InfoExtractor):
|
|||||||
self._downloader.to_screen("[youtube] user %s: Collected %d video ids (downloading %d of them)" %
|
self._downloader.to_screen("[youtube] user %s: Collected %d video ids (downloading %d of them)" %
|
||||||
(username, all_ids_count, len(video_ids)))
|
(username, all_ids_count, len(video_ids)))
|
||||||
|
|
||||||
|
if reverseorder:
|
||||||
|
video_ids.reverse()
|
||||||
|
|
||||||
for video_id in video_ids:
|
for video_id in video_ids:
|
||||||
self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % video_id)
|
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)
|
dest='playliststart', metavar='NUMBER', help='playlist video to start at (default is 1)', default=1)
|
||||||
selection.add_option('--playlist-end',
|
selection.add_option('--playlist-end',
|
||||||
dest='playlistend', metavar='NUMBER', help='playlist video to end at (default is last)', default=-1)
|
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('--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)
|
selection.add_option('--max-downloads', metavar='NUMBER', dest='max_downloads', help='Abort after downloading NUMBER files', default=None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user