小编Sha*_*Nag的帖子

使用Python将YouTube视频下载到某个目录

我已尝试使用以下代码在YouTube上下载视频并且它正常运行,但我想将视频保存在特定位置.现在它正在保存视频C:/Users/Download.如果我想在桌面上保存视频,我需要在代码中进行哪些更改?

from __future__ import unicode_literals
import youtube_dl
import urllib
import shutil
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['https://www.youtube.com/watch?v=n06H7OcPd-g'])
Run Code Online (Sandbox Code Playgroud)

python python-2.7 python-3.x

24
推荐指数
4
解决办法
5万
查看次数

标签 统计

python ×1

python-2.7 ×1

python-3.x ×1