summaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/huya.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:06:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:06:10 +0000
commit137f07c27a88b07df57df5b2cdebebe3c7722bac (patch)
tree4ebdcbea6b540f69c40ba0be6ac766008030d149 /yt_dlp/extractor/huya.py
parentAdding debian version 2024.05.27-1. (diff)
downloadyt-dlp-137f07c27a88b07df57df5b2cdebebe3c7722bac.tar.xz
yt-dlp-137f07c27a88b07df57df5b2cdebebe3c7722bac.zip
Merging upstream version 2024.07.01.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'yt_dlp/extractor/huya.py')
-rw-r--r--yt_dlp/extractor/huya.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/yt_dlp/extractor/huya.py b/yt_dlp/extractor/huya.py
index 5379b54..5663a78 100644
--- a/yt_dlp/extractor/huya.py
+++ b/yt_dlp/extractor/huya.py
@@ -1,9 +1,10 @@
+import base64
import hashlib
import random
import re
+import urllib.parse
from .common import InfoExtractor
-from ..compat import compat_b64decode, compat_urlparse
from ..utils import (
ExtractorError,
int_or_none,
@@ -32,7 +33,7 @@ class HuyaLiveIE(InfoExtractor):
},
}, {
'url': 'https://www.huya.com/xiaoyugame',
- 'only_matching': True
+ 'only_matching': True,
}]
_RESOLUTION = {
@@ -46,8 +47,8 @@ class HuyaLiveIE(InfoExtractor):
},
'流畅': {
'width': 800,
- 'height': 480
- }
+ 'height': 480,
+ },
}
def _real_extract(self, url):
@@ -70,7 +71,7 @@ class HuyaLiveIE(InfoExtractor):
continue
stream_name = stream_info.get('sStreamName')
re_secret = not screen_type and live_source_type in (0, 8, 13)
- params = dict(compat_urlparse.parse_qsl(unescapeHTML(stream_info['sFlvAntiCode'])))
+ params = dict(urllib.parse.parse_qsl(unescapeHTML(stream_info['sFlvAntiCode'])))
fm, ss = '', ''
if re_secret:
fm, ss = self.encrypt(params, stream_info, stream_name)
@@ -127,6 +128,6 @@ class HuyaLiveIE(InfoExtractor):
'uuid': int_or_none(ct % 1e7 * 1e6 % 0xffffffff),
't': '100',
})
- fm = compat_b64decode(params['fm']).decode().split('_', 1)[0]
+ fm = base64.b64decode(params['fm']).decode().split('_', 1)[0]
ss = hashlib.md5('|'.join([params['seqid'], params['ctype'], params['t']]))
return fm, ss