[webtoons] extend 'bgm' option (#8733)
allow remuxing bgm audio into a different format/container
This commit is contained in:
@@ -6833,13 +6833,20 @@ Note
|
|||||||
extractor.webtoons.bgm
|
extractor.webtoons.bgm
|
||||||
----------------------
|
----------------------
|
||||||
Type
|
Type
|
||||||
``bool``
|
* ``bool``
|
||||||
|
* ``string``
|
||||||
Default
|
Default
|
||||||
``true``
|
``true``
|
||||||
|
Example
|
||||||
|
``"aac"``
|
||||||
Description
|
Description
|
||||||
Download an episode's `background music` if available.
|
Download an episode's `background music` if available.
|
||||||
|
|
||||||
|
If this is a ``string``, remux the downloaded `background music` file
|
||||||
|
into the given format.
|
||||||
Note
|
Note
|
||||||
Requires |ytdl|
|
Requires |ytdl| for downloads
|
||||||
|
and |ffmpeg| for remuxing
|
||||||
|
|
||||||
|
|
||||||
extractor.webtoons.quality
|
extractor.webtoons.quality
|
||||||
|
|||||||
@@ -172,6 +172,12 @@ class WebtoonsEpisodeExtractor(WebtoonsBase, GalleryExtractor):
|
|||||||
}
|
}
|
||||||
paths = self.paths
|
paths = self.paths
|
||||||
|
|
||||||
|
if isinstance(self.bgm, str):
|
||||||
|
remux = ext = self.bgm.lower()
|
||||||
|
else:
|
||||||
|
ext = "mp4"
|
||||||
|
remux = False
|
||||||
|
|
||||||
for bgm in bgm_list:
|
for bgm in bgm_list:
|
||||||
url = (f"https://apis.naver.com/audiocweb/audiocplayogwweb/play"
|
url = (f"https://apis.naver.com/audiocweb/audiocplayogwweb/play"
|
||||||
f"/audio/{bgm['audioId']}/hls/token")
|
f"/audio/{bgm['audioId']}/hls/token")
|
||||||
@@ -190,10 +196,11 @@ class WebtoonsEpisodeExtractor(WebtoonsBase, GalleryExtractor):
|
|||||||
"num_stop": paths.get(stop) or 0,
|
"num_stop": paths.get(stop) or 0,
|
||||||
"filename_play": play[play.rfind("/")+1:play.rfind(".")],
|
"filename_play": play[play.rfind("/")+1:play.rfind(".")],
|
||||||
"filename_stop": stop[stop.rfind("/")+1:stop.rfind(".")],
|
"filename_stop": stop[stop.rfind("/")+1:stop.rfind(".")],
|
||||||
|
"extension": ext,
|
||||||
"type": "bgm",
|
"type": "bgm",
|
||||||
"url" : "ytdl:" + audio["url"],
|
"url" : "ytdl:" + audio["url"],
|
||||||
"_ytdl_manifest": audio["type"].lower(),
|
"_ytdl_manifest": audio["type"].lower(),
|
||||||
"extension": "mp3",
|
"_ytdl_manifest_remux": remux,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user