Skip to content

Instantly share code, notes, and snippets.

@rajendrakumaryadav
Created August 7, 2022 15:13
Show Gist options
  • Save rajendrakumaryadav/637e47569dd02153eab0aab25427cfb7 to your computer and use it in GitHub Desktop.
Save rajendrakumaryadav/637e47569dd02153eab0aab25427cfb7 to your computer and use it in GitHub Desktop.
Extact audio using yt-dlp, pass the urls as comma seperated form.
import yt_dlp
url = input("Enter the URL of the video: ")
URLS = []
URLS.append(url)
ydl_opts = {
'format': 'mp3/bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
}]
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
error_code = ydl.download(URLS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment