1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..compat
import compat_urllib_parse_unquote
15 class XVideosIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?xvideos\.com/video(?P<id>[0-9]+)(?:.*)'
18 'url': 'http://www.xvideos.com/video4588838/biker_takes_his_girl',
19 'md5': '4b46ae6ea5e6e9086e714d883313c0c9',
23 'title': 'Biker Takes his Girl',
28 _ANDROID_USER_AGENT
= 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(url
, 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)
38 video_url
= compat_urllib_parse_unquote(
39 self
._search
_regex
(r
'flv_url=(.+?)&', webpage
, 'video URL'))
40 video_title
= self
._html
_search
_regex
(
41 r
'<title>(.*?)\s+-\s+XVID', webpage
, 'title')
42 video_thumbnail
= self
._search
_regex
(
43 r
'url_bigthumb=(.+?)&', webpage
, 'thumbnail', fatal
=False)
49 android_req
= sanitized_Request(url
)
50 android_req
.add_header('User-Agent', self
._ANDROID
_USER
_AGENT
)
51 android_webpage
= self
._download
_webpage
(android_req
, video_id
, fatal
=False)
53 if android_webpage
is not None:
54 player_params_str
= self
._search
_regex
(
55 'mobileReplacePlayerDivTwoQual\(([^)]+)\)',
56 android_webpage
, 'player parameters', default
='')
57 player_params
= list(map(lambda s
: s
.strip(' \''), player_params_str
.split(',')))
62 } for param
in player_params
if determine_ext(param
) == 'mp4'])
64 self
._sort
_formats
(formats
)
71 'thumbnail': video_thumbnail
,