From 7e8ca819c307ad187d7d94c360241b45f4c66e6e Mon Sep 17 00:00:00 2001 From: Parmjit Virk Date: Tue, 17 Apr 2018 14:47:26 -0500 Subject: [PATCH] [KeezMovies] Applied third requested fixes for PR #16154 --- youtube_dl/extractor/common.py | 9 ++------- youtube_dl/extractor/keezmovies.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 0a3776a43..59b9d3739 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -1078,14 +1078,9 @@ class InfoExtractor(object): html, '%s form' % form_id, group='form') return self._hidden_inputs(form) - def _sort_formats(self, formats, field_preference=None, fatal=True): + def _sort_formats(self, formats, field_preference=None): if not formats: - msg = 'No video formats found' - if fatal: - raise ExtractorError(msg) - else: - self._downloader.report_warning(msg) - return None + raise ExtractorError('No video formats found') for f in formats: # Automatically determine tbr when missing based on abr and vbr (improves diff --git a/youtube_dl/extractor/keezmovies.py b/youtube_dl/extractor/keezmovies.py index a8b4ddcfb..9b1bdf8d4 100644 --- a/youtube_dl/extractor/keezmovies.py +++ b/youtube_dl/extractor/keezmovies.py @@ -36,7 +36,7 @@ class KeezMoviesIE(InfoExtractor): 'only_matching': True, }] - def _extract_info(self, url): + def _extract_info(self, url, fatal=True): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') display_id = (mobj.group('display_id') @@ -105,7 +105,13 @@ class KeezMoviesIE(InfoExtractor): raise ExtractorError( 'Video %s is no longer available' % video_id, expected=True) - self._sort_formats(formats, fatal=False) + try: + self._sort_formats(formats) + except ExtractorError as e: + if fatal: + raise ExtractorError(e, expected=True) + else: + self._downloader.report_warning(e) if not title: title = self._html_search_regex(