aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-05-03 20:07:35 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-05-03 20:07:35 +0200
commitc34407d16c18df0e5045d00b46bfdc692329dcfd (patch)
tree2b3b9d9a6a816e4c9c8bf84c75e20d40a22e75cd
parent5e34d2ebbf9906bded4201d7bd8bb82e9353de9f (diff)
Simplify RedTube
-rw-r--r--test/tests.json2
-rwxr-xr-xyoutube_dl/InfoExtractors.py28
-rw-r--r--youtube_dl/__init__.py3
3 files changed, 16 insertions, 17 deletions
diff --git a/test/tests.json b/test/tests.json
index 6013a13ab..2d49495d2 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -405,7 +405,7 @@
}
},
{
- "name": "Redtube",
+ "name": "RedTube",
"url": "http://www.redtube.com/66418",
"file": "66418.mp4",
"md5": "7b8c22b5e7098a3e1c09709df1126d2d",
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index 8b2442bac..7d4a60cc8 100755
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -4183,31 +4183,29 @@ class BandcampIE(InfoExtractor):
return [track_info]
-class RedtubeIE(InfoExtractor):
+class RedTubeIE(InfoExtractor):
"""Information Extractor for redtube"""
_VALID_URL = r'(?:http://)?(?:www\.)?redtube\.com/(?P<id>[0-9]+)'
- IE_NAME = u'redtube'
def _real_extract(self,url):
mobj = re.match(self._VALID_URL, url)
if mobj is None:
- self._downloader.report_error(u'invalid URL: %s' % url)
- return
+ raise ExtractorError(u'Invalid URL: %s' % url)
+
video_id = mobj.group('id')
video_extension = 'mp4'
webpage = self._download_webpage(url, video_id)
self.report_extraction(video_id)
mobj = re.search(r'<source src="'+'(.+)'+'" type="video/mp4">',webpage)
- if mobj is not None:
- video_url = mobj.group(1)
- else:
- self._downloader.report_error(u'unable to extract media URL')
- return
- mobj = re.search('<h1 class="videoTitle slidePanelMovable">'+r'(.+)'+r'</h1>',webpage)
- if mobj is not None:
- video_title = mobj.group(1)
- else:
- video_title = 'Redtube - %s' % time.ctime()
+
+ if mobj is None:
+ raise ExtractorError(u'Unable to extract media URL')
+
+ video_url = mobj.group(1)
+ mobj = re.search('<h1 class="videoTitle slidePanelMovable">(.+)</h1>',webpage)
+ if mobj is None:
+ raise ExtractorError(u'Unable to extract title')
+ video_title = mobj.group(1)
return [{
'id': video_id,
@@ -4272,7 +4270,7 @@ def gen_extractors():
ARDIE(),
TumblrIE(),
BandcampIE(),
- RedtubeIE(),
+ RedTubeIE(),
GenericIE()
]
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index 808d4a8c2..823ca63a4 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -388,7 +388,8 @@ def _real_main(argv=None):
if 'http' in proxies and 'https' not in proxies:
proxies['https'] = proxies['http']
proxy_handler = compat_urllib_request.ProxyHandler(proxies)
- opener = compat_urllib_request.build_opener(proxy_handler, cookie_processor, YoutubeDLHandler())
+ https_handler = compat_urllib_request.HTTPSHandler()
+ opener = compat_urllib_request.build_opener(https_handler, proxy_handler, cookie_processor, YoutubeDLHandler())
compat_urllib_request.install_opener(opener)
socket.setdefaulttimeout(300) # 5 minutes should be enough (famous last words)