From d4eec0b2824750430e5dec8be061ac43e6a4edb7 Mon Sep 17 00:00:00 2001 From: Kataick <24969684+Kataick@users.noreply.github.com> Date: Sun, 4 Jun 2023 12:57:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=99=8E=E7=89=99=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=AF=BC=E8=87=B4=E8=BF=9B=E7=A8=8B=E7=BB=88=E6=AD=A2?= =?UTF-8?q?=E9=97=AE=E9=A2=98(=E7=BB=9F=E4=B8=80=E5=86=99=E6=B3=95)=20(#45?= =?UTF-8?q?0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复抖音可能导致进程卡死问题 * 修复抖音获取串流导致进程卡死(return false版) * 修复虎牙可能导致进程终止问题 * 统一代码写法 --- biliup/plugins/huya.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/biliup/plugins/huya.py b/biliup/plugins/huya.py index f3121d1..1852dd8 100644 --- a/biliup/plugins/huya.py +++ b/biliup/plugins/huya.py @@ -19,8 +19,12 @@ class Huya(DownloadBase): def check_stream(self): logger.debug(self.fname) - res = requests.get(self.url, timeout=5, headers=self.fake_headers) - res.close() + try: + res = requests.get(self.url, timeout=5, headers=self.fake_headers) + except: + return False + finally: + res.close() huya = None if match1(res.text, '"stream": "([a-zA-Z0-9+=/]+)"'): huya = base64.b64decode(match1(res.text, '"stream": "([a-zA-Z0-9+=/]+)"')).decode()