aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorMike Col <MikeCol@gmx.net>2014-01-23 03:51:09 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-23 03:51:09 +0100
commit65d781128aee4f0a0609f6140ba1b232b9794781 (patch)
treef96b0edbf23d4bb44d2b5962b8429b951a695ddd /youtube_dl
parentc35b1b07e2ca9dfac0cb897fd5ad047bebf15400 (diff)
[xhamster] Add support for hd video
Signed-off-by: Philipp Hagemeister <phihag@phihag.de>
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/xhamster.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/youtube_dl/extractor/xhamster.py b/youtube_dl/extractor/xhamster.py
index ef9997ee4..fe13024d5 100644
--- a/youtube_dl/extractor/xhamster.py
+++ b/youtube_dl/extractor/xhamster.py
@@ -45,6 +45,13 @@ class XHamsterIE(InfoExtractor):
else:
return mobj.group('server')+'/key='+mobj.group('file')
+ def extract_mp4_video_url(webpage):
+ mp4 = re.search(r'<a href=\"(.+?)\" class=\"mp4Play\"',webpage)
+ if mp4 is None:
+ return None
+ else:
+ return mp4.group(1)
+
def is_hd(webpage):
return webpage.find('<div class=\'icon iconHD\'') != -1
@@ -80,14 +87,25 @@ class XHamsterIE(InfoExtractor):
age_limit = self._rta_search(webpage)
- video_url = extract_video_url(webpage)
hd = is_hd(webpage)
+
+ video_url = extract_video_url(webpage)
formats = [{
'url': video_url,
'ext': determine_ext(video_url),
'format': 'hd' if hd else 'sd',
'format_id': 'hd' if hd else 'sd',
}]
+
+ video_mp4_url = extract_mp4_video_url(webpage)
+ if (not video_mp4_url is None) and (formats[0]['ext'] != 'mp4'):
+ formats.append( {
+ 'url': video_mp4_url,
+ 'ext': 'mp4',
+ 'format': 'hd' if hd else 'sd',
+ 'format_id': 'hd' if hd else 'sd',
+ })
+
if not hd:
webpage = self._download_webpage(mrss_url+'?hd', video_id)
if is_hd(webpage):