[acfun] use hls instead of flv for live stream to avoid broken video

This commit is contained in:
johnsmith2077 2020-10-07 18:06:38 +08:00
parent 165ff0aab2
commit c21015f533
1 changed files with 7 additions and 2 deletions

View File

@ -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"),
}