mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-23 00:54:31 +01:00
[wetv] Python 2 compat, improve tests
This commit is contained in:
parent
c8157b6fe7
commit
f81ffe53e5
@ -76,39 +76,53 @@ class WeTvIE(WeTvBaseInfoExtractor):
|
|||||||
)
|
)
|
||||||
(?P<id>[a-z\d]{11})
|
(?P<id>[a-z\d]{11})
|
||||||
(?:$|[^a-z\d])'''
|
(?:$|[^a-z\d])'''
|
||||||
_TESTS = [{
|
_TESTS = [
|
||||||
'url': 'https://wetv.vip/play?vid=o00318x0wds',
|
{
|
||||||
'md5': '6b07174a61ed9c1dfb8defab3b40ba12',
|
'url': 'https://wetv.vip/play?vid=o00318x0wds',
|
||||||
'info_dict': {
|
'md5': 'e07ac4c842ed9363ee8a70ee3b72b047',
|
||||||
'id': 'o00318x0wds',
|
'info_dict': {
|
||||||
'ext': 'mp4',
|
'id': 'o00318x0wds',
|
||||||
'title': "EP1\uff1aThe King's Avatar",
|
'ext': 'mp4',
|
||||||
|
'title': "EP1\uff1aThe King's Avatar",
|
||||||
|
'thumbnail': r're:^https?://.*\.png.*$',
|
||||||
|
'duration': 2696,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'hls_prefer_native': True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://wetv.vip/en/play/jenizogwk2t8400/o00318x0wds',
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': "https://wetv.vip/en/play/jenizogwk2t8400-The%20King's%20Avatar/play?vid=o00318x0wds",
|
||||||
|
'only_matching': True,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://wetv.vip/en/play/a3150lwr4jn-Ve-Po-Ad%20Review%20%2F%20HowTo',
|
||||||
|
'note': 'user video',
|
||||||
|
'md5': '551b6d76d72a67933f25e6b7b078c865',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'a3150lwr4jn',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Ve-Po-Ad Review / HowTo',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'hls_prefer_native': True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://wetv.vip/en/play/h31438yuulr',
|
||||||
|
'note': 'non-m3u8',
|
||||||
|
'md5': 'c1b83ac4653d38b2d5e423caeab4148b',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'h31438yuulr',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Gokukoku no Brynhildr - "Ichiban Boshi" \u2014 Full Ending',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}, {
|
]
|
||||||
'url': 'https://wetv.vip/en/play/jenizogwk2t8400/o00318x0wds',
|
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
'url': "https://wetv.vip/en/play/jenizogwk2t8400-The%20King's%20Avatar/play?vid=o00318x0wds",
|
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
# user video
|
|
||||||
'url': 'https://wetv.vip/en/play/a3150lwr4jn-Ve-Po-Ad%20Review%20%2F%20HowTo',
|
|
||||||
'md5': 'b053543f584bb4ae10767b5c6bf67807',
|
|
||||||
'info_dict': {
|
|
||||||
'id': 'a3150lwr4jn',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Ve-Po-Ad Review / HowTo',
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
# non-m3u8
|
|
||||||
'url': 'https://wetv.vip/en/play/h31438yuulr',
|
|
||||||
'md5': 'c1b83ac4653d38b2d5e423caeab4148b',
|
|
||||||
'info_dict': {
|
|
||||||
'id': 'h31438yuulr',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Gokukoku no Brynhildr - "Ichiban Boshi" \u2014 Full Ending',
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_guid():
|
def create_guid():
|
||||||
@ -291,18 +305,31 @@ class WeTvPlaylistIE(WeTvBaseInfoExtractor):
|
|||||||
$|
|
$|
|
||||||
/(?!(?:play\?vid=)?[a-z\d]{11})
|
/(?!(?:play\?vid=)?[a-z\d]{11})
|
||||||
)'''
|
)'''
|
||||||
_TESTS = [{
|
_TESTS = [
|
||||||
'url': 'https://wetv.vip/en/play/jenizogwk2t8400',
|
{
|
||||||
'info_dict': {
|
'url': 'https://wetv.vip/en/play/jenizogwk2t8400',
|
||||||
'id': 'jenizogwk2t8400',
|
'info_dict': {
|
||||||
'title': "The King's Avatar",
|
'id': 'jenizogwk2t8400',
|
||||||
'description': 'md5:eca1c149133af485673d7676d4eff0c9',
|
'title': "The King's Avatar",
|
||||||
|
'description': 'md5:eca1c149133af485673d7676d4eff0c9',
|
||||||
|
},
|
||||||
|
'playlist_count': 40,
|
||||||
},
|
},
|
||||||
'playlist_count': 40,
|
{
|
||||||
}, {
|
'url': 'https://wetv.vip/play?cid=jenizogwk2t8400',
|
||||||
'url': 'https://wetv.vip/play?cid=jenizogwk2t8400',
|
'only_matching': True,
|
||||||
'only_matching': True,
|
},
|
||||||
}]
|
{
|
||||||
|
'url': 'https://wetv.vip/en/play/0odpmck0od6ylsb',
|
||||||
|
'note': 'movie',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '0odpmck0od6ylsb',
|
||||||
|
'title': 'Mystified',
|
||||||
|
'description': 'md5:92717c44e1f89133c634cd5827c67636',
|
||||||
|
},
|
||||||
|
'playlist_count': 1,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
playlist_id = self._match_id(url)
|
playlist_id = self._match_id(url)
|
||||||
@ -314,13 +341,12 @@ class WeTvPlaylistIE(WeTvBaseInfoExtractor):
|
|||||||
for video_info in info['videoList']:
|
for video_info in info['videoList']:
|
||||||
parsed_info = WeTvBaseInfoExtractor.parse_video_info(video_info)
|
parsed_info = WeTvBaseInfoExtractor.parse_video_info(video_info)
|
||||||
smuggled_url = smuggle_url(
|
smuggled_url = smuggle_url(
|
||||||
'wetv:{}'.format(parsed_info['id'], ),
|
'wetv:{}'.format(parsed_info['id']),
|
||||||
{
|
{
|
||||||
'playlist_id': playlist_id,
|
'playlist_id': playlist_id,
|
||||||
'lang_code': lang_code,
|
'lang_code': lang_code,
|
||||||
'country_code': country_code,
|
'country_code': country_code,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
parsed_info.update({
|
parsed_info.update({
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
'url': smuggled_url,
|
'url': smuggled_url,
|
||||||
@ -337,7 +363,7 @@ class WeTvPlaylistIE(WeTvBaseInfoExtractor):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CKey:
|
class CKey(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.encryption_arrays = [[
|
self.encryption_arrays = [[
|
||||||
1332468387, -1641050960, 2136896045, -1629555948,
|
1332468387, -1641050960, 2136896045, -1629555948,
|
||||||
@ -352,11 +378,11 @@ class CKey:
|
|||||||
-391724567, -1068702727, -381903814, -648522509,
|
-391724567, -1068702727, -381903814, -648522509,
|
||||||
-1266234148, 1959407397, -1644776673, 1152313324]]
|
-1266234148, 1959407397, -1644776673, 1152313324]]
|
||||||
d = [None] * 256
|
d = [None] * 256
|
||||||
f = d.copy()
|
f = d[::]
|
||||||
g = d.copy()
|
g = d[::]
|
||||||
h = d.copy()
|
h = d[::]
|
||||||
j = d.copy()
|
j = d[::]
|
||||||
o = d.copy()
|
o = d[::]
|
||||||
for i in range(256):
|
for i in range(256):
|
||||||
o[i] = i << 1 if i < 128 else i << 1 ^ 283
|
o[i] = i << 1 if i < 128 else i << 1 ^ 283
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user