fix(youtubedownloader): fixed file not found error if the video name includes / or \
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 1m50s
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 1m50s
This commit is contained in:
parent
4e4c16f278
commit
f7be30dcd8
1 changed files with 2 additions and 1 deletions
|
@ -65,7 +65,8 @@ class YouTubeDownloader(commands.Cog):
|
|||
def youtube_download(url: str, path: str):
|
||||
"""This function does the actual downloading of the YouTube Video."""
|
||||
yt = YouTube(url=url)
|
||||
filename = f"{yt.title} ({yt.video_id})"
|
||||
translation_table = dict.fromkeys(map(ord, r'<>:"/\|?*'), None)
|
||||
filename = f"{yt.title.translate(translation_table)} ({yt.video_id})"
|
||||
if audio_only:
|
||||
stream = yt.streams.filter(only_audio=True, mime_type='audio/mp4')
|
||||
stream = stream.order_by('abr')
|
||||
|
|
Loading…
Reference in a new issue