diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 4ff1ca13c..bffa3b824 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -922,9 +922,9 @@ class YoutubeDL(object): x_forwarded_for = ie_result.get('__x_forwarded_for_ip') - if self.params.get('date_playlist_order') == 'desc' and self.params.get('playlist_reverse'): + if self.params.get('date_playlist_order') == 'desc' and self.params.get('playlistreverse'): entries.reverse() - elif self.params.get('date_playlist_order') == 'asc' and not self.params.get('playlist_reverse'): + elif self.params.get('date_playlist_order') == 'asc' and not self.params.get('playlistreverse'): entries.reverse() for i, entry in enumerate(entries, 1): @@ -954,10 +954,11 @@ class YoutubeDL(object): download=download, extra_info=extra) - entry_result_uploaddate = entry_result.get('upload_date') - if entry_result_uploaddate: - if self.params.get('date_playlist_order') in ('desc', 'asc') and entry_result_uploaddate not in self.params.get('daterange'): - break + if entry_result is not None: # backwards compatibility, lol + entry_result_uploaddate = entry_result.get('upload_date') + if entry_result_uploaddate: + if self.params.get('date_playlist_order') in ('desc', 'asc') and entry_result_uploaddate not in self.params.get('daterange'): + break playlist_results.append(entry_result) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index f15606568..b715bd69c 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -352,6 +352,7 @@ def _real_main(argv=None): 'playlistend': opts.playlistend, 'playlistreverse': opts.playlist_reverse, 'playlistrandom': opts.playlist_random, + 'date_playlist_order': opts.date_playlist_order, 'noplaylist': opts.noplaylist, 'logtostderr': opts.outtmpl == '-', 'consoletitle': opts.consoletitle, diff --git a/youtube_dl/options.py b/youtube_dl/options.py index f351d9fd7..d4c2fd971 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -489,11 +489,11 @@ def parseOpts(overrideArguments=None): help=optparse.SUPPRESS_HELP) downloader.add_option( '--playlist-reverse', - dest='playlist_reverse', action='store_true', + action='store_true', help='Download playlist videos in reverse order') downloader.add_option( '--playlist-random', - dest='playlist_random', action='store_true', + action='store_true', help='Download playlist videos in random order') downloader.add_option( '--xattr-set-filesize',