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