1 from __future__ import unicode_literals
5 from .common import InfoExtractor
13 class XVideosIE(InfoExtractor):
14 _VALID_URL = r'^(?:https?://)?(?:www\.)?xvideos\.com/video([0-9]+)(?:.*)'
16 'url': 'http://www.xvideos.com/video4588838/biker_takes_his_girl',
17 'md5': '4b46ae6ea5e6e9086e714d883313c0c9',
21 'title': 'Biker Takes his Girl',
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group(1)
30 webpage = self._download_webpage(url, video_id)
32 self.report_extraction(video_id)
34 mobj = re.search(r'<h1 class="inlineError">(.+?)</h1>', webpage)
36 raise ExtractorError('%s said: %s' % (self.IE_NAME, clean_html(mobj.group(1))), expected=True)
39 video_url = compat_urllib_parse.unquote(
40 self._search_regex(r'flv_url=(.+?)&', webpage, 'video URL'))
43 video_title = self._html_search_regex(
44 r'<title>(.*?)\s+-\s+XVID', webpage, 'title')
46 # Extract video thumbnail
47 video_thumbnail = self._search_regex(
48 r'url_bigthumb=(.+?)&', webpage, 'thumbnail', fatal=False)
57 'thumbnail': video_thumbnail,