|
|
@ -6,22 +6,31 @@ import re
|
|
|
|
import string
|
|
|
|
import string
|
|
|
|
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
|
|
|
from ..compat import (
|
|
|
|
|
|
|
|
compat_b64decode,
|
|
|
|
|
|
|
|
compat_ord,
|
|
|
|
|
|
|
|
compat_struct_pack,
|
|
|
|
|
|
|
|
)
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
ExtractorError,
|
|
|
|
ExtractorError,
|
|
|
|
int_or_none,
|
|
|
|
int_or_none,
|
|
|
|
mimetype2ext,
|
|
|
|
mimetype2ext,
|
|
|
|
parse_codecs,
|
|
|
|
parse_codecs,
|
|
|
|
|
|
|
|
parse_qs,
|
|
|
|
update_url_query,
|
|
|
|
update_url_query,
|
|
|
|
urljoin,
|
|
|
|
urljoin,
|
|
|
|
xpath_element,
|
|
|
|
xpath_element,
|
|
|
|
xpath_text,
|
|
|
|
xpath_text,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from ..compat import (
|
|
|
|
|
|
|
|
compat_b64decode,
|
|
|
|
|
|
|
|
compat_ord,
|
|
|
|
def compat_random_choices(population, *args, **kwargs):
|
|
|
|
compat_struct_pack,
|
|
|
|
# weights=None, *, cum_weights=None, k=1
|
|
|
|
compat_urlparse,
|
|
|
|
# limited implementation needed here
|
|
|
|
)
|
|
|
|
weights = args[0] if args else kwargs.get('weights')
|
|
|
|
|
|
|
|
assert all(w is None for w in (weights, kwargs.get('cum_weights')))
|
|
|
|
|
|
|
|
k = kwargs.get('k', 1)
|
|
|
|
|
|
|
|
return ''.join(random.choice(population) for _ in range(k))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VideaIE(InfoExtractor):
|
|
|
|
class VideaIE(InfoExtractor):
|
|
|
@ -35,6 +44,7 @@ class VideaIE(InfoExtractor):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(?P<id>[^?#&]+)
|
|
|
|
(?P<id>[^?#&]+)
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
_EMBED_REGEX = [r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//videa\.hu/player\?.*?\bv=.+?)\1']
|
|
|
|
_TESTS = [{
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'http://videa.hu/videok/allatok/az-orult-kigyasz-285-kigyot-kigyo-8YfIAjxwWGwT8HVQ',
|
|
|
|
'url': 'http://videa.hu/videok/allatok/az-orult-kigyasz-285-kigyot-kigyo-8YfIAjxwWGwT8HVQ',
|
|
|
|
'md5': '97a7af41faeaffd9f1fc864a7c7e7603',
|
|
|
|
'md5': '97a7af41faeaffd9f1fc864a7c7e7603',
|
|
|
@ -44,6 +54,7 @@ class VideaIE(InfoExtractor):
|
|
|
|
'title': 'Az őrült kígyász 285 kígyót enged szabadon',
|
|
|
|
'title': 'Az őrült kígyász 285 kígyót enged szabadon',
|
|
|
|
'thumbnail': r're:^https?://.*',
|
|
|
|
'thumbnail': r're:^https?://.*',
|
|
|
|
'duration': 21,
|
|
|
|
'duration': 21,
|
|
|
|
|
|
|
|
'age_limit': 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
'url': 'http://videa.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH',
|
|
|
|
'url': 'http://videa.hu/videok/origo/jarmuvek/supercars-elozes-jAHDWfWSJH5XuFhH',
|
|
|
@ -54,6 +65,7 @@ class VideaIE(InfoExtractor):
|
|
|
|
'title': 'Supercars előzés',
|
|
|
|
'title': 'Supercars előzés',
|
|
|
|
'thumbnail': r're:^https?://.*',
|
|
|
|
'thumbnail': r're:^https?://.*',
|
|
|
|
'duration': 64,
|
|
|
|
'duration': 64,
|
|
|
|
|
|
|
|
'age_limit': 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
'url': 'http://videa.hu/player?v=8YfIAjxwWGwT8HVQ',
|
|
|
|
'url': 'http://videa.hu/player?v=8YfIAjxwWGwT8HVQ',
|
|
|
@ -64,6 +76,7 @@ class VideaIE(InfoExtractor):
|
|
|
|
'title': 'Az őrült kígyász 285 kígyót enged szabadon',
|
|
|
|
'title': 'Az őrült kígyász 285 kígyót enged szabadon',
|
|
|
|
'thumbnail': r're:^https?://.*',
|
|
|
|
'thumbnail': r're:^https?://.*',
|
|
|
|
'duration': 21,
|
|
|
|
'duration': 21,
|
|
|
|
|
|
|
|
'age_limit': 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
'url': 'http://videa.hu/player/v/8YfIAjxwWGwT8HVQ?autoplay=1',
|
|
|
|
'url': 'http://videa.hu/player/v/8YfIAjxwWGwT8HVQ?autoplay=1',
|
|
|
@ -80,11 +93,14 @@ class VideaIE(InfoExtractor):
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
_STATIC_SECRET = 'xHb0ZvME5q8CBcoQi6AngerDu3FGO9fkUlwPmLVY_RTzj2hJIS4NasXWKy1td7p'
|
|
|
|
_STATIC_SECRET = 'xHb0ZvME5q8CBcoQi6AngerDu3FGO9fkUlwPmLVY_RTzj2hJIS4NasXWKy1td7p'
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@classmethod
|
|
|
|
def _extract_urls(webpage):
|
|
|
|
def _extract_urls(cls, webpage):
|
|
|
|
return [url for _, url in re.findall(
|
|
|
|
def yield_urls():
|
|
|
|
r'<iframe[^>]+src=(["\'])(?P<url>(?:https?:)?//videa\.hu/player\?.*?\bv=.+?)\1',
|
|
|
|
for pattern in cls._EMBED_REGEX:
|
|
|
|
webpage)]
|
|
|
|
for m in re.finditer(pattern, webpage):
|
|
|
|
|
|
|
|
yield m.group('url')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list(yield_urls())
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def rc4(cipher_text, key):
|
|
|
|
def rc4(cipher_text, key):
|
|
|
@ -130,13 +146,13 @@ class VideaIE(InfoExtractor):
|
|
|
|
for i in range(0, 32):
|
|
|
|
for i in range(0, 32):
|
|
|
|
result += s[i - (self._STATIC_SECRET.index(l[i]) - 31)]
|
|
|
|
result += s[i - (self._STATIC_SECRET.index(l[i]) - 31)]
|
|
|
|
|
|
|
|
|
|
|
|
query = compat_urlparse.parse_qs(compat_urlparse.urlparse(player_url).query)
|
|
|
|
query = parse_qs(player_url)
|
|
|
|
random_seed = ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(8))
|
|
|
|
random_seed = ''.join(compat_random_choices(string.ascii_letters + string.digits, k=8))
|
|
|
|
query['_s'] = random_seed
|
|
|
|
query['_s'] = random_seed
|
|
|
|
query['_t'] = result[:16]
|
|
|
|
query['_t'] = result[:16]
|
|
|
|
|
|
|
|
|
|
|
|
b64_info, handle = self._download_webpage_handle(
|
|
|
|
b64_info, handle = self._download_webpage_handle(
|
|
|
|
'http://videa.hu/videaplayer_get_xml.php', video_id, query=query)
|
|
|
|
'http://videa.hu/player/xml', video_id, query=query)
|
|
|
|
if b64_info.startswith('<?xml'):
|
|
|
|
if b64_info.startswith('<?xml'):
|
|
|
|
info = self._parse_xml(b64_info, video_id)
|
|
|
|
info = self._parse_xml(b64_info, video_id)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|