From e00a1585b5dba244acb2e6115161300a09aba7d9 Mon Sep 17 00:00:00 2001 From: ForgQi <34411314+ForgQi@users.noreply.github.com> Date: Sun, 4 Aug 2019 15:35:31 +0800 Subject: [PATCH] Fix huya --- .gitignore | 1 + engine/plugins/__init__.py | 4 +++- engine/plugins/huya.py | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e6ecb68..933c739 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ .idea/encodings.xml *.png *.flv +*.mp4 *.part old/ config.yaml diff --git a/engine/plugins/__init__.py b/engine/plugins/__init__.py index 9d35565..519930b 100644 --- a/engine/plugins/__init__.py +++ b/engine/plugins/__init__.py @@ -151,9 +151,11 @@ class SDownload(DownloadBase): raise +# ffmpeg.exe -i http://vfile1.grtn.cn/2018/1542/0254/3368/154202543368.ssm/154202543368.m3u8 +# -c copy -bsf:a aac_adtstoasc -movflags +faststart output.mp4 class FFmpegdl(DownloadBase): def download(self): - args = ['ffmpeg', '-y', '-i', self.ydl_opts['absurl'], '-c', 'copy', '-f', 'flv', + args = ['ffmpeg', '-y', '-i', self.ydl_opts['absurl'], '-c', 'copy', '-f', self.suffix, self.ydl_opts['outtmpl'] + '.part'] proc = subprocess.Popen(args, stdin=subprocess.PIPE) try: diff --git a/engine/plugins/huya.py b/engine/plugins/huya.py index 69c1ffc..2eec271 100644 --- a/engine/plugins/huya.py +++ b/engine/plugins/huya.py @@ -12,7 +12,7 @@ user_agent = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebK class Huya(FFmpegdl): - def __init__(self, fname, url, suffix='flv'): + def __init__(self, fname, url, suffix='mp4'): super().__init__(fname, url, suffix) def check_stream(self): @@ -23,8 +23,8 @@ class Huya(FFmpegdl): huya = engine.plugins.match1(data, r'({"sCdnType":"TX".*?})') if huya: huyajson = json.loads(huya) - self.ydl_opts["absurl"] = huyajson["sFlvUrl"] + '/' + huyajson["sStreamName"] + '.' + \ - huyajson["sFlvUrlSuffix"] + '?' + huyajson["sFlvAntiCode"] + "&ratio=2000" + self.ydl_opts["absurl"] = huyajson["sHlsUrl"] + '/' + huyajson["sStreamName"] + '.' + \ + huyajson["sHlsUrlSuffix"] + '?' + huyajson["sHlsAntiCode"] return True