3 from .common
import InfoExtractor
14 # based on openload_decode from 2bfeee69b976fe049761dd3012e30b637ee05a58
15 def aa_decode(aa_code
):
17 ('7', '((゚ー゚) + (o^_^o))'),
18 ('6', '((o^_^o) +(o^_^o))'),
19 ('5', '((゚ー゚) + (゚Θ゚))'),
20 ('2', '((o^_^o) - (゚Θ゚))'),
28 for aa_char
in aa_code
.split(delim
):
29 for val
, pat
in symbol_table
:
30 aa_char
= aa_char
.replace(pat
, val
)
31 aa_char
= aa_char
.replace('+ ', '')
32 m
= re
.match(r
'^\d+', aa_char
)
34 ret
+= chr(int(m
.group(0), 8))
36 m
= re
.match(r
'^u([\da-f]+)', aa_char
)
38 ret
+= chr(int(m
.group(1), 16))
42 class XFileShareIE(InfoExtractor
):
44 (r
'aparat\.cam', 'Aparat'),
45 (r
'clipwatching\.com', 'ClipWatching'),
46 (r
'gounlimited\.to', 'GoUnlimited'),
47 (r
'govid\.me', 'GoVid'),
48 (r
'holavid\.com', 'HolaVid'),
49 (r
'streamty\.com', 'Streamty'),
50 (r
'thevideobee\.to', 'TheVideoBee'),
51 (r
'uqload\.com', 'Uqload'),
52 (r
'vidbom\.com', 'VidBom'),
53 (r
'vidlo\.us', 'vidlo'),
54 (r
'vidlocker\.xyz', 'VidLocker'),
55 (r
'vidshare\.tv', 'VidShare'),
57 (r
'wolfstream\.tv', 'WolfStream'),
58 (r
'xvideosharing\.com', 'XVideoSharing'),
61 IE_DESC
= 'XFileShare based sites: %s' % ', '.join(list(zip(*_SITES
))[1])
62 _VALID_URL
= (r
'https?://(?:www\.)?(?P<host>%s)/(?:embed-)?(?P<id>[0-9a-zA-Z]+)'
63 % '|'.join(site
for site
in list(zip(*_SITES
))[0]))
64 _EMBED_REGEX
= [r
'<iframe\b[^>]+\bsrc=(["\'])(?P
<url
>(?
:https?
:)?
//(?
:%s)/embed
-[0-9a
-zA
-Z
]+.*?
)\
1' % '|
'.join(site for site in list(zip(*_SITES))[0])]
66 _FILE_NOT_FOUND_REGEXES = (
67 r'>(?
:404 - )?File Not Found
<',
68 r'>The
file was removed by administrator
<',
72 'url
': 'https
://uqload
.com
/dltx1wztngdz
',
73 'md5
': '3cfbb65e4c90e93d7b37bcb65a595557
',
77 'title
': 'Rick Astley Never Gonna Give You mp4
',
78 'thumbnail
': r're
:https
://.*\
.jpg
'
81 'url
': 'http
://xvideosharing
.com
/fq65f94nd2ve
',
82 'md5
': '4181f63957e8fe90ac836fa58dc3c8a6
',
87 'thumbnail
': r're
:http
://.*\
.jpg
',
90 'url
': 'https
://aparat
.cam
/n4d6dh0wvlpr
',
91 'only_matching
': True,
93 'url
': 'https
://wolfstream
.tv
/nthme29v9u2x
',
94 'only_matching
': True,
97 def _real_extract(self, url):
98 host, video_id = self._match_valid_url(url).groups()
100 url = 'https
://%s/' % host + ('embed
-%s.html
' % video_id if host in ('govid
.me
', 'vidlo
.us
') else video_id)
101 webpage = self._download_webpage(url, video_id)
103 if any(re.search(p, webpage) for p in self._FILE_NOT_FOUND_REGEXES):
104 raise ExtractorError('Video
%s does
not exist
' % video_id, expected=True)
106 fields = self._hidden_inputs(webpage)
108 if fields.get('op
') == 'download1
':
109 countdown = int_or_none(self._search_regex(
110 r'<span
id="countdown_str">(?
:[Ww
]ait
)?\s
*<span
id="cxc">(\d
+)</span
>\s
*(?
:seconds?
)?
</span
>',
111 webpage, 'countdown
', default=None))
113 self._sleep(countdown, video_id)
115 webpage = self._download_webpage(
116 url, video_id, 'Downloading video page
',
117 data=urlencode_postdata(fields), headers={
119 'Content
-type': 'application
/x
-www
-form
-urlencoded
',
122 title = (self._search_regex(
123 (r'style
="z-index: [0-9]+;">([^
<]+)</span
>',
124 r'<td nowrap
>([^
<]+)</td
>',
125 r'h4
-fine
[^
>]*>([^
<]+)<',
127 r'<h2
class="video-page-head">([^
<]+)</h2
>',
128 r'<h2 style
="[^"]*color
:#403f3d[^"]*"[^>]*>([^<]+)<', # streamin.to
129 r
'title\s*:\s*"([^"]+)"'), # govid.me
130 webpage
, 'title', default
=None) or self
._og
_search
_title
(
131 webpage
, default
=None) or video_id
).strip()
134 (r
'(eval\(function\(p,a,c,k,e,d\){.+)', decode_packed_codes
),
135 (r
'(゚.+)', aa_decode
)):
136 obf_code
= self
._search
_regex
(regex
, webpage
, 'obfuscated code', default
=None)
138 webpage
= webpage
.replace(obf_code
, func(obf_code
))
142 jwplayer_data
= self
._search
_regex
(
144 r
'jwplayer\("[^"]+"\)\.load\(\[({.+?})\]\);',
145 r
'jwplayer\("[^"]+"\)\.setup\(({.+?})\);',
147 'jwplayer data', default
=None)
149 jwplayer_data
= self
._parse
_json
(
150 jwplayer_data
.replace(r
"\'", "'"), video_id
, js_to_json
)
152 formats
= self
._parse
_jwplayer
_data
(
153 jwplayer_data
, video_id
, False,
154 m3u8_id
='hls', mpd_id
='dash')['formats']
159 r
'(?:file|src)\s*:\s*(["\'])(?P
<url
>http(?
:(?
!\
1).)+\
.(?
:m3u8|mp4|flv
)(?
:(?
!\
1).)*)\
1',
160 r'file_link\s
*=\s
*(["\'])(?P<url>http(?:(?!\1).)+)\1',
161 r'addVariable\((\\?["\'])file\
1\s
*,\s
*(\\?
["\'])(?P<url>http(?:(?!\2).)+)\2\)',
162 r'<embed[^>]+src=(["\'])(?P
<url
>http(?
:(?
!\
1).)+\
.(?
:m3u8|mp4|flv
)(?
:(?
!\
1).)*)\
1'):
163 for mobj in re.finditer(regex, webpage):
164 video_url = mobj.group('url
')
165 if video_url not in urls:
166 urls.append(video_url)
168 sources = self._search_regex(
169 r'sources\s
*:\s
*(\
[(?
!{)[^\
]]+\
])', webpage, 'sources
', default=None)
171 urls.extend(self._parse_json(sources, video_id))
174 for video_url in urls:
175 if determine_ext(video_url) == 'm3u8
':
176 formats.extend(self._extract_m3u8_formats(
177 video_url, video_id, 'mp4
',
178 entry_protocol='m3u8_native
', m3u8_id='hls
',
185 self._sort_formats(formats)
187 thumbnail = self._search_regex(
189 r'<video
[^
>]+poster
="([^"]+)"',
190 r'(?:image|poster)\s*:\s*["\'](http
[^
"\']+)["\'],',
191 ], webpage, 'thumbnail
', default=None)
196 'thumbnail
': thumbnail,
198 'http_headers
': {'Referer': url}