parent
c77df98b1a
commit
fbbb5508ea
1 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
|
|
||||||
from ..compat import compat_urlparse, compat_b64decode
|
from ..compat import compat_urlparse, compat_b64decode
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ class HuyaLiveIE(InfoExtractor):
|
||||||
}]
|
}]
|
||||||
|
|
||||||
_RESOLUTION = {
|
_RESOLUTION = {
|
||||||
'蓝光4M': {
|
'蓝光': {
|
||||||
'width': 1920,
|
'width': 1920,
|
||||||
'height': 1080,
|
'height': 1080,
|
||||||
},
|
},
|
||||||
|
@ -76,11 +77,15 @@ class HuyaLiveIE(InfoExtractor):
|
||||||
if re_secret:
|
if re_secret:
|
||||||
fm, ss = self.encrypt(params, stream_info, stream_name)
|
fm, ss = self.encrypt(params, stream_info, stream_name)
|
||||||
for si in stream_data.get('vMultiStreamInfo'):
|
for si in stream_data.get('vMultiStreamInfo'):
|
||||||
|
display_name, bitrate = re.fullmatch(
|
||||||
|
r'(.+?)(?:(\d+)M)?', si.get('sDisplayName')).groups()
|
||||||
rate = si.get('iBitRate')
|
rate = si.get('iBitRate')
|
||||||
if rate:
|
if rate:
|
||||||
params['ratio'] = rate
|
params['ratio'] = rate
|
||||||
else:
|
else:
|
||||||
params.pop('ratio', None)
|
params.pop('ratio', None)
|
||||||
|
if bitrate:
|
||||||
|
rate = int(bitrate) * 1000
|
||||||
if re_secret:
|
if re_secret:
|
||||||
params['wsSecret'] = hashlib.md5(
|
params['wsSecret'] = hashlib.md5(
|
||||||
'_'.join([fm, params['u'], stream_name, ss, params['wsTime']]))
|
'_'.join([fm, params['u'], stream_name, ss, params['wsTime']]))
|
||||||
|
@ -90,7 +95,7 @@ class HuyaLiveIE(InfoExtractor):
|
||||||
'tbr': rate,
|
'tbr': rate,
|
||||||
'url': update_url_query(f'{stream_url}/{stream_name}.{stream_info.get("sFlvUrlSuffix")}',
|
'url': update_url_query(f'{stream_url}/{stream_name}.{stream_info.get("sFlvUrlSuffix")}',
|
||||||
query=params),
|
query=params),
|
||||||
**self._RESOLUTION.get(si.get('sDisplayName'), {}),
|
**self._RESOLUTION.get(display_name, {}),
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue