6 from .common
import InfoExtractor
7 from ..compat
import compat_ord
21 class VideaIE(InfoExtractor
):
26 videok/(?:[^/]+/)*[^?#&]+-|
27 (?:videojs_)?player\?.*?\bv=|
32 _EMBED_REGEX
= [r
'<iframe[^>]+src=(["\'])(?P
<url
>(?
:https?
:)?
//videa\
.hu
/player
\?.*?
\bv
=.+?
)\
1']
34 'url
': 'http
://videa
.hu
/videok
/allatok
/az
-orult
-kigyasz
-285-kigyot
-kigyo
-8YfIAjxwWGwT8HVQ
',
35 'md5
': '97a7af41faeaffd9f1fc864a7c7e7603
',
37 'id': '8YfIAjxwWGwT8HVQ
',
39 'title
': 'Az őrült kígyász
285 kígyót enged szabadon
',
40 'thumbnail
': r're
:^https?
://.*',
45 'url
': 'http
://videa
.hu
/videok
/origo
/jarmuvek
/supercars
-elozes
-jAHDWfWSJH5XuFhH
',
46 'md5
': 'd57ccd8812c7fd491d33b1eab8c99975
',
48 'id': 'jAHDWfWSJH5XuFhH
',
50 'title
': 'Supercars előzés
',
51 'thumbnail
': r're
:^https?
://.*',
56 'url
': 'http
://videa
.hu
/player?v
=8YfIAjxwWGwT8HVQ
',
57 'md5
': '97a7af41faeaffd9f1fc864a7c7e7603
',
59 'id': '8YfIAjxwWGwT8HVQ
',
61 'title
': 'Az őrült kígyász
285 kígyót enged szabadon
',
62 'thumbnail
': r're
:^https?
://.*',
67 'url
': 'http
://videa
.hu
/player
/v
/8YfIAjxwWGwT8HVQ?autoplay
=1',
68 'only_matching
': True,
70 'url
': 'https
://videakid
.hu
/videok
/origo
/jarmuvek
/supercars
-elozes
-jAHDWfWSJH5XuFhH
',
71 'only_matching
': True,
73 'url
': 'https
://videakid
.hu
/player?v
=8YfIAjxwWGwT8HVQ
',
74 'only_matching
': True,
76 'url
': 'https
://videakid
.hu
/player
/v
/8YfIAjxwWGwT8HVQ?autoplay
=1',
77 'only_matching
': True,
79 _STATIC_SECRET = 'xHb0ZvME5q8CBcoQi6AngerDu3FGO9fkUlwPmLVY_RTzj2hJIS4NasXWKy1td7p
'
82 def rc4(cipher_text, key):
90 j = (j + S[i] + ord(key[i % key_len])) % 256
91 S[i], S[j] = S[j], S[i]
95 for m in range(len(cipher_text)):
98 S[i], S[j] = S[j], S[i]
99 k = S[(S[i] + S[j]) % 256]
100 res += struct.pack('B
', k ^ compat_ord(cipher_text[m]))
104 def _real_extract(self, url):
105 video_id = self._match_id(url)
106 video_page = self._download_webpage(url, video_id)
108 if 'videa
.hu
/player
' in url:
110 player_page = video_page
112 player_url = self._search_regex(
113 r'<iframe
.*?src
="(/player\?[^"]+)"', video_page, 'player url')
114 player_url = urljoin(url, player_url)
115 player_page = self._download_webpage(player_url, video_id)
117 nonce = self._search_regex(
118 r'_xt\s*=\s*"([^
"]+)"', player_page, 'nonce
')
123 result += s[i - (self._STATIC_SECRET.index(l[i]) - 31)]
125 query = parse_qs(player_url)
126 random_seed = ''.join(random.choices(string.ascii_letters + string.digits, k=8))
127 query['_s
'] = random_seed
128 query['_t
'] = result[:16]
130 b64_info, handle = self._download_webpage_handle(
131 'http
://videa
.hu
/player
/xml
', video_id, query=query)
132 if b64_info.startswith('<?xml
'):
133 info = self._parse_xml(b64_info, video_id)
135 key = result[16:] + random_seed + handle.headers['x
-videa
-xs
']
136 info = self._parse_xml(self.rc4(
137 base64.b64decode(b64_info), key), video_id)
139 video = xpath_element(info, './video
', 'video
')
141 raise ExtractorError(xpath_element(
142 info, './error
', fatal=True), expected=True)
143 sources = xpath_element(
144 info, './video_sources
', 'sources
', fatal=True)
145 hash_values = xpath_element(
146 info, './hash_values
', 'hash values
', fatal=False)
148 title = xpath_text(video, './title
', fatal=True)
151 for source in sources.findall('./video_source
'):
152 source_url = source.text
153 source_name = source.get('name
')
154 source_exp = source.get('exp
')
155 if not (source_url and source_name):
158 xpath_text(hash_values, 'hash_value_
' + source_name)
159 if hash_values is not None else None)
160 if hash_value and source_exp:
161 source_url = update_url_query(source_url, {
163 'expires
': source_exp,
165 f = parse_codecs(source.get('codecs
'))
167 'url
': self._proto_relative_url(source_url),
168 'ext
': mimetype2ext(source.get('mimetype
')) or 'mp4
',
169 'format_id
': source.get('name
'),
170 'width
': int_or_none(source.get('width
')),
171 'height
': int_or_none(source.get('height
')),
175 thumbnail = self._proto_relative_url(xpath_text(video, './poster_src
'))
178 is_adult = xpath_text(video, './is_adult_content
', default=None)
180 age_limit = 18 if is_adult == '1' else 0
185 'thumbnail
': thumbnail,
186 'duration
': int_or_none(xpath_text(video, './duration
')),
187 'age_limit
': age_limit,