diff options
author | Filippo Valsorda <filippo.valsorda@gmail.com> | 2012-08-19 18:46:23 +0200 |
---|---|---|
committer | Filippo Valsorda <filippo.valsorda@gmail.com> | 2012-08-19 18:46:23 +0200 |
commit | 795cc5059a6f349f861e246269d6cced39b3a753 (patch) | |
tree | 1e6d4c2023c7e1539aeffe2fe13dab341a8ea9d6 /youtube_dl | |
parent | 5dc846fad08126c372cd80bd473165182e0b541c (diff) |
Re-engineered XNXXIE to actually exit on ERRORs even with -i
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/InfoExtractors.py | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 2b313966f..6c4a1b1f1 100644 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -3098,30 +3098,6 @@ class XNXXIE(InfoExtractor): """Report information extraction""" self._downloader.to_screen(u'[%s] %s: Extracting information' % (self.IE_NAME, video_id)) - def extract_video_url(self, webpage): - "Extract the url for the video from the webpage" - - result = re.search(self.VIDEO_URL_RE, webpage) - if result is None: - self._downloader.trouble(u'ERROR: unable to extract video url') - return urllib.unquote(result.group(1).decode('utf-8')) - - def extract_video_title(self, webpage): - "Extract the title for the video from the webpage" - - result = re.search(self.VIDEO_TITLE_RE, webpage) - if result is None: - self._downloader.trouble(u'ERROR: unable to extract video title') - return result.group(1).decode('utf-8') - - def extract_video_thumbnail(self, webpage): - "Extract the thumbnail for the video from the webpage" - - result = re.search(self.VIDEO_THUMB_RE, webpage) - if result is None: - self._downloader.trouble(u'ERROR: unable to extract video thumbnail') - return result.group(1).decode('utf-8') - def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) if mobj is None: @@ -3138,14 +3114,32 @@ class XNXXIE(InfoExtractor): self._downloader.trouble(u'ERROR: unable to download video webpage: %s' % err) return + result = re.search(self.VIDEO_URL_RE, webpage) + if result is None: + self._downloader.trouble(u'ERROR: unable to extract video url') + return + video_url = urllib.unquote(result.group(1).decode('utf-8')) + + result = re.search(self.VIDEO_TITLE_RE, webpage) + if result is None: + self._downloader.trouble(u'ERROR: unable to extract video title') + return + video_title = result.group(1).decode('utf-8') + + result = re.search(self.VIDEO_THUMB_RE, webpage) + if result is None: + self._downloader.trouble(u'ERROR: unable to extract video thumbnail') + return + video_thumbnail = result.group(1).decode('utf-8') + info = {'id': video_id, - 'url': self.extract_video_url(webpage), + 'url': video_url, 'uploader': None, 'upload_date': None, - 'title': self.extract_video_title(webpage), + 'title': video_title, 'ext': 'flv', 'format': 'flv', - 'thumbnail': self.extract_video_thumbnail(webpage), + 'thumbnail': video_thumbnail, 'description': None, 'player_url': None} |