mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 18:34:32 +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',
|
'url': 'https://wetv.vip/play?vid=o00318x0wds',
|
||||||
'md5': '6b07174a61ed9c1dfb8defab3b40ba12',
|
'md5': 'e07ac4c842ed9363ee8a70ee3b72b047',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'o00318x0wds',
|
'id': 'o00318x0wds',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': "EP1\uff1aThe King's Avatar",
|
'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',
|
'url': 'https://wetv.vip/en/play/jenizogwk2t8400/o00318x0wds',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
'url': "https://wetv.vip/en/play/jenizogwk2t8400-The%20King's%20Avatar/play?vid=o00318x0wds",
|
'url': "https://wetv.vip/en/play/jenizogwk2t8400-The%20King's%20Avatar/play?vid=o00318x0wds",
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}, {
|
},
|
||||||
# user video
|
{
|
||||||
'url': 'https://wetv.vip/en/play/a3150lwr4jn-Ve-Po-Ad%20Review%20%2F%20HowTo',
|
'url': 'https://wetv.vip/en/play/a3150lwr4jn-Ve-Po-Ad%20Review%20%2F%20HowTo',
|
||||||
'md5': 'b053543f584bb4ae10767b5c6bf67807',
|
'note': 'user video',
|
||||||
|
'md5': '551b6d76d72a67933f25e6b7b078c865',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'a3150lwr4jn',
|
'id': 'a3150lwr4jn',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Ve-Po-Ad Review / HowTo',
|
'title': 'Ve-Po-Ad Review / HowTo',
|
||||||
}
|
},
|
||||||
}, {
|
'params': {
|
||||||
# non-m3u8
|
'hls_prefer_native': True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
'url': 'https://wetv.vip/en/play/h31438yuulr',
|
'url': 'https://wetv.vip/en/play/h31438yuulr',
|
||||||
|
'note': 'non-m3u8',
|
||||||
'md5': 'c1b83ac4653d38b2d5e423caeab4148b',
|
'md5': 'c1b83ac4653d38b2d5e423caeab4148b',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'h31438yuulr',
|
'id': 'h31438yuulr',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Gokukoku no Brynhildr - "Ichiban Boshi" \u2014 Full Ending',
|
'title': 'Gokukoku no Brynhildr - "Ichiban Boshi" \u2014 Full Ending',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}]
|
]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_guid():
|
def create_guid():
|
||||||
@ -291,7 +305,8 @@ class WeTvPlaylistIE(WeTvBaseInfoExtractor):
|
|||||||
$|
|
$|
|
||||||
/(?!(?:play\?vid=)?[a-z\d]{11})
|
/(?!(?:play\?vid=)?[a-z\d]{11})
|
||||||
)'''
|
)'''
|
||||||
_TESTS = [{
|
_TESTS = [
|
||||||
|
{
|
||||||
'url': 'https://wetv.vip/en/play/jenizogwk2t8400',
|
'url': 'https://wetv.vip/en/play/jenizogwk2t8400',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'jenizogwk2t8400',
|
'id': 'jenizogwk2t8400',
|
||||||
@ -299,10 +314,22 @@ class WeTvPlaylistIE(WeTvBaseInfoExtractor):
|
|||||||
'description': 'md5:eca1c149133af485673d7676d4eff0c9',
|
'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