python使用youtube_dl库获取网站上的音频/音乐文件
import youtube_dl
url = "你需要的音乐网址"
ydl_opts = {
'format': 'bestaudio/best',
'outtmpl': 'downloaded_audio.%(ext)s',
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
import youtube_dl
url = "你需要的音乐网址"
ydl_opts = {
'format': 'bestaudio/best',
'outtmpl': 'downloaded_audio.%(ext)s',
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])