From: Sergey M․ Date: Wed, 5 Aug 2015 14:32:44 +0000 (+0600) Subject: [xhamster] Make more robust X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=be7a8379b47c35afe66abcc02aee597e5143b1d5;p=youtube-dl [xhamster] Make more robust --- diff --git a/youtube_dl/extractor/xhamster.py b/youtube_dl/extractor/xhamster.py index 9d025530f..481d79b89 100644 --- a/youtube_dl/extractor/xhamster.py +++ b/youtube_dl/extractor/xhamster.py @@ -46,12 +46,12 @@ class XHamsterIE(InfoExtractor): ] def _real_extract(self, url): - def extract_video_url(webpage): - mp4 = re.search(r'file:\s+\'([^\']+)\'', webpage) - if mp4 is None: - raise ExtractorError('Unable to extract media URL') - else: - return mp4.group(1) + def extract_video_url(webpage, name): + return self._search_regex( + [r'''file\s*:\s*(?P["'])(?P.+?)(?P=q)''', + r'''["'])(?P.+?)(?P=q)\s+class=["']mp4Thumb''', + r''']+file=(?P["'])(?P.+?)(?P=q)[^>]*>'''], + webpage, name, group='mp4') def is_hd(webpage): return '