1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from ..compat
import compat_urllib_parse_unquote
16 class XVideosIE(InfoExtractor
):
20 (?:[^/]+\.)?xvideos2?\.com/video|
21 (?:www\.)?xvideos\.es/video|
22 (?:www|flashservice)\.xvideos\.com/embedframe/|
23 static-hw\.xvideos\.com/swf/xv-player\.swf\?.*?\bid_video=
28 'url': 'https://www.xvideos.com/video4588838/motorcycle_guy_cucks_influencer_steals_his_gf',
29 'md5': '14cea69fcb84db54293b1e971466c2e1',
33 'title': 'Motorcycle Guy Cucks Influencer, Steals his GF',
36 'thumbnail': r
're:^https://img-hw.xvideos-cdn.com/.+\.jpg',
40 'url': 'https://www.xvideos.com/video65982001/what_s_her_name',
41 'md5': 'b82d7d7ef7d65a84b1fa6965f81f95a5',
45 'title': 'what\'s her name?',
48 'thumbnail': r
're:^https://img-hw.xvideos-cdn.com/.+\.jpg',
51 'url': 'https://flashservice.xvideos.com/embedframe/4588838',
52 'only_matching': True,
54 'url': 'https://www.xvideos.com/embedframe/4588838',
55 'only_matching': True,
57 'url': 'http://static-hw.xvideos.com/swf/xv-player.swf?id_video=4588838',
58 'only_matching': True,
60 'url': 'http://xvideos.com/video4588838/biker_takes_his_girl',
63 'url': 'https://xvideos.com/video4588838/biker_takes_his_girl',
66 'url': 'https://xvideos.es/video4588838/biker_takes_his_girl',
69 'url': 'https://www.xvideos.es/video4588838/biker_takes_his_girl',
72 'url': 'http://xvideos.es/video4588838/biker_takes_his_girl',
75 'url': 'http://www.xvideos.es/video4588838/biker_takes_his_girl',
78 'url': 'http://fr.xvideos.com/video4588838/biker_takes_his_girl',
81 'url': 'https://fr.xvideos.com/video4588838/biker_takes_his_girl',
84 'url': 'http://it.xvideos.com/video4588838/biker_takes_his_girl',
87 'url': 'https://it.xvideos.com/video4588838/biker_takes_his_girl',
90 'url': 'http://de.xvideos.com/video4588838/biker_takes_his_girl',
93 'url': 'https://de.xvideos.com/video4588838/biker_takes_his_girl',
97 def _real_extract(self
, url
):
98 video_id
= self
._match
_id
(url
)
99 webpage
= self
._download
_webpage
(url
, video_id
)
101 mobj
= re
.search(r
'<h1 class="inlineError">(.+?)</h1>', webpage
)
103 raise ExtractorError('%s said: %s' % (self
.IE_NAME
, clean_html(mobj
.group(1))), expected
=True)
105 title
= self
._html
_search
_regex
(
106 (r
'<title>(?P<title>.+?)\s+-\s+XVID',
107 r
'setVideoTitle\s*\(\s*(["\'])(?P
<title
>(?
:(?
!\
1).)+)\
1'),
108 webpage, 'title
', default=None,
109 group='title
') or self._og_search_title(webpage)
112 for preference, thumbnail in enumerate(('', '169')):
113 thumbnail_url = self._search_regex(
114 r'setThumbUrl
%s\
(\s
*(["\'])(?P<thumbnail>(?:(?!\1).)+)\1' % thumbnail,
115 webpage, 'thumbnail', default=None, group='thumbnail')
118 'url': thumbnail_url,
119 'preference': preference,
122 duration = int_or_none(self._og_search_property(
123 'duration', webpage, default=None)) or parse_duration(
125 r'<span[^>]+class=["\']duration
["\'][^>]*>.*?(\d[^<]+)',
126 webpage, 'duration', fatal=False))
130 video_url = compat_urllib_parse_unquote(self._search_regex(
131 r'flv_url=(.+?)&', webpage, 'video URL', default=''))
138 for kind, _, format_url in re.findall(
139 r'setVideo([^(]+)\((["\'])(http
.+?
)\
2\
)', webpage):
140 format_id = kind.lower()
141 if format_id == 'hls
':
142 hls_formats = self._extract_m3u8_formats(
143 format_url, video_id, 'mp4
',
144 entry_protocol='m3u8_native
', m3u8_id='hls
', fatal=False)
145 self._check_formats(hls_formats, video_id)
146 formats.extend(hls_formats)
147 elif format_id in ('urllow
', 'urlhigh
'):
150 'format_id
': '%s-%s' % (determine_ext(format_url, 'mp4
'), format_id[3:]),
151 'quality
': -2 if format_id.endswith('low
') else None,
154 self._sort_formats(formats)
160 'duration
': duration,
161 'thumbnails
': thumbnails,