From c21015f533b5282ac6d1cc9f521b7854792216bf Mon Sep 17 00:00:00 2001 From: johnsmith2077 Date: Wed, 7 Oct 2020 18:06:38 +0800 Subject: [PATCH] [acfun] use hls instead of flv for live stream to avoid broken video --- youtube_dl/extractor/acfun.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/acfun.py b/youtube_dl/extractor/acfun.py index 7be5db967..76c31ede0 100644 --- a/youtube_dl/extractor/acfun.py +++ b/youtube_dl/extractor/acfun.py @@ -194,7 +194,6 @@ class AcfunBangumiIE(BasicAcfunInfoExtractor): def _all_episodes(self, bangumi_id): timestamp = int_or_none(float_or_none(time.time(), invscale=1000)) - print("Timestamp: ", timestamp) webpage = self._download_webpage( self._FETCH_EPISODES_URL % (bangumi_id, timestamp), bangumi_id, @@ -333,9 +332,15 @@ class AcfunLiveIE(BasicAcfunInfoExtractor): formats = [] for stream in representation: + # use hls instead of flv to fix video broken problem when stopped + i = stream["url"].index("flv?") + u3m8_url = ( + stream["url"][0:i].replace("pull.etoote.com", "hlspull.etoote.com") + + "m3u8" + ) formats += [ { - "url": stream["url"], + "url": u3m8_url, "ext": "mp4", "tbr": stream.get("bitrate"), }