5 from .common
import InfoExtractor
6 from ..compat
import compat_b64decode
, compat_ord
20 class VideaIE(InfoExtractor
):
25 videok/(?:[^/]+/)*[^?#&]+-|
26 (?:videojs_)?player\?.*?\bv=|
31 _EMBED_REGEX
= [r
'<iframe[^>]+src=(["\'])(?P
<url
>(?
:https?
:)?
//videa\
.hu
/player
\?.*?
\bv
=.+?
)\
1']
33 'url
': 'http
://videa
.hu
/videok
/allatok
/az
-orult
-kigyasz
-285-kigyot
-kigyo
-8YfIAjxwWGwT8HVQ
',
34 'md5
': '97a7af41faeaffd9f1fc864a7c7e7603
',
36 'id': '8YfIAjxwWGwT8HVQ
',
38 'title
': 'Az őrült kígyász
285 kígyót enged szabadon
',
39 'thumbnail
': r're
:^https?
://.*',
44 'url
': 'http
://videa
.hu
/videok
/origo
/jarmuvek
/supercars
-elozes
-jAHDWfWSJH5XuFhH
',
45 'md5
': 'd57ccd8812c7fd491d33b1eab8c99975
',
47 'id': 'jAHDWfWSJH5XuFhH
',
49 'title
': 'Supercars előzés
',
50 'thumbnail
': r're
:^https?
://.*',
55 'url
': 'http
://videa
.hu
/player?v
=8YfIAjxwWGwT8HVQ
',
56 'md5
': '97a7af41faeaffd9f1fc864a7c7e7603
',
58 'id': '8YfIAjxwWGwT8HVQ
',
60 'title
': 'Az őrült kígyász
285 kígyót enged szabadon
',
61 'thumbnail
': r're
:^https?
://.*',
66 'url
': 'http
://videa
.hu
/player
/v
/8YfIAjxwWGwT8HVQ?autoplay
=1',
67 'only_matching
': True,
69 'url
': 'https
://videakid
.hu
/videok
/origo
/jarmuvek
/supercars
-elozes
-jAHDWfWSJH5XuFhH
',
70 'only_matching
': True,
72 'url
': 'https
://videakid
.hu
/player?v
=8YfIAjxwWGwT8HVQ
',
73 'only_matching
': True,
75 'url
': 'https
://videakid
.hu
/player
/v
/8YfIAjxwWGwT8HVQ?autoplay
=1',
76 'only_matching
': True,
78 _STATIC_SECRET = 'xHb0ZvME5q8CBcoQi6AngerDu3FGO9fkUlwPmLVY_RTzj2hJIS4NasXWKy1td7p
'
81 def rc4(cipher_text, key):
89 j = (j + S[i] + ord(key[i % key_len])) % 256
90 S[i], S[j] = S[j], S[i]
94 for m in range(len(cipher_text)):
97 S[i], S[j] = S[j], S[i]
98 k = S[(S[i] + S[j]) % 256]
99 res += struct.pack('B
', k ^ compat_ord(cipher_text[m]))
103 def _real_extract(self, url):
104 video_id = self._match_id(url)
105 video_page = self._download_webpage(url, video_id)
107 if 'videa
.hu
/player
' in url:
109 player_page = video_page
111 player_url = self._search_regex(
112 r'<iframe
.*?src
="(/player\?[^"]+)"', video_page, 'player url')
113 player_url = urljoin(url, player_url)
114 player_page = self._download_webpage(player_url, video_id)
116 nonce = self._search_regex(
117 r'_xt\s*=\s*"([^
"]+)"', player_page, 'nonce
')
121 for i in range(0, 32):
122 result += s[i - (self._STATIC_SECRET.index(l[i]) - 31)]
124 query = parse_qs(player_url)
125 random_seed = ''.join(random.choices(string.ascii_letters + string.digits, k=8))
126 query['_s
'] = random_seed
127 query['_t
'] = result[:16]
129 b64_info, handle = self._download_webpage_handle(
130 'http
://videa
.hu
/player
/xml
', video_id, query=query)
131 if b64_info.startswith('<?xml
'):
132 info = self._parse_xml(b64_info, video_id)
134 key = result[16:] + random_seed + handle.headers['x
-videa
-xs
']
135 info = self._parse_xml(self.rc4(
136 compat_b64decode(b64_info), key), video_id)
138 video = xpath_element(info, './video
', 'video
')
140 raise ExtractorError(xpath_element(
141 info, './error
', fatal=True), expected=True)
142 sources = xpath_element(
143 info, './video_sources
', 'sources
', fatal=True)
144 hash_values = xpath_element(
145 info, './hash_values
', 'hash values
', fatal=False)
147 title = xpath_text(video, './title
', fatal=True)
150 for source in sources.findall('./video_source
'):
151 source_url = source.text
152 source_name = source.get('name
')
153 source_exp = source.get('exp
')
154 if not (source_url and source_name):
157 xpath_text(hash_values, 'hash_value_
' + source_name)
158 if hash_values is not None else None)
159 if hash_value and source_exp:
160 source_url = update_url_query(source_url, {
162 'expires
': source_exp,
164 f = parse_codecs(source.get('codecs
'))
166 'url
': self._proto_relative_url(source_url),
167 'ext
': mimetype2ext(source.get('mimetype
')) or 'mp4
',
168 'format_id
': source.get('name
'),
169 'width
': int_or_none(source.get('width
')),
170 'height
': int_or_none(source.get('height
')),
174 thumbnail = self._proto_relative_url(xpath_text(video, './poster_src
'))
177 is_adult = xpath_text(video, './is_adult_content
', default=None)
179 age_limit = 18 if is_adult == '1' else 0
184 'thumbnail
': thumbnail,
185 'duration
': int_or_none(xpath_text(video, './duration
')),
186 'age_limit
': age_limit,