diff options
author | Yen Chi Hsuan <[email protected]> | 2015-12-13 15:37:52 +0800 |
---|---|---|
committer | Yen Chi Hsuan <[email protected]> | 2015-12-13 15:43:20 +0800 |
commit | b5424acdb9983dbb761aed2f014dadeeac355930 (patch) | |
tree | ecd027abed8b49f37fe7a03a389ce8d2fc2d2a77 | |
parent | 47c7f3d99504325c43651b781376ea470e7e28bd (diff) | |
download | youtube-dl-b5424acdb9983dbb761aed2f014dadeeac355930.tar.gz youtube-dl-b5424acdb9983dbb761aed2f014dadeeac355930.zip |
[novamov] Improve existence checking
-rw-r--r-- | youtube_dl/extractor/novamov.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/extractor/novamov.py b/youtube_dl/extractor/novamov.py index 0c4ff90f2..a2a527ac3 100644 --- a/youtube_dl/extractor/novamov.py +++ b/youtube_dl/extractor/novamov.py @@ -40,6 +40,10 @@ class NovaMovIE(InfoExtractor): 'skip': '"Invalid token" errors abound (in web interface as well as youtube-dl, there is nothing we can do about it.)' } + def _check_existence(self, webpage, video_id): + if re.search(self._FILE_DELETED_REGEX, webpage) is not None: + raise ExtractorError('Video %s does not exist' % video_id, expected=True) + def _real_extract(self, url): video_id = self._match_id(url) @@ -48,8 +52,7 @@ class NovaMovIE(InfoExtractor): webpage = self._download_webpage( url, video_id, 'Downloading video page') - if re.search(self._FILE_DELETED_REGEX, webpage) is not None: - raise ExtractorError('Video %s does not exist' % video_id, expected=True) + self._check_existence(webpage, video_id) def extract_filekey(default=NO_DEFAULT): filekey = self._search_regex( @@ -75,6 +78,7 @@ class NovaMovIE(InfoExtractor): request.add_header('Referer', post_url) webpage = self._download_webpage( request, video_id, 'Downloading continue to the video page') + self._check_existence(webpage, video_id) filekey = extract_filekey() |