1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

[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

View File

@ -194,7 +194,6 @@ class AcfunBangumiIE(BasicAcfunInfoExtractor):
def _all_episodes(self, bangumi_id): def _all_episodes(self, bangumi_id):
timestamp = int_or_none(float_or_none(time.time(), invscale=1000)) timestamp = int_or_none(float_or_none(time.time(), invscale=1000))
print("Timestamp: ", timestamp)
webpage = self._download_webpage( webpage = self._download_webpage(
self._FETCH_EPISODES_URL % (bangumi_id, timestamp), self._FETCH_EPISODES_URL % (bangumi_id, timestamp),
bangumi_id, bangumi_id,
@ -333,9 +332,15 @@ class AcfunLiveIE(BasicAcfunInfoExtractor):
formats = [] formats = []
for stream in representation: 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 += [ formats += [
{ {
"url": stream["url"], "url": u3m8_url,
"ext": "mp4", "ext": "mp4",
"tbr": stream.get("bitrate"), "tbr": stream.get("bitrate"),
} }