将youtube-d完成后的文件移动

2024-05-19 03:39:12 发布

您现在位置:Python中文网/ 问答频道 /正文

我要“youtube dl”从youtube下载一段视频。并移动到新文件夹: 来自youtube dl文档:

--exec CMD                       Execute a command on the file after
                                 downloading, similar to find's -exec
                                 syntax. Example: --exec 'adb push {}
                                 /sdcard/Music/ && rm {}'

我想把它包含在我的Raspberry Pi的Rasbian中的python脚本中,要移动文件,我必须指定“old file”如下:

^{pr2}$

如何“引用”该文件,或者如何做到这一点?在

编辑:

phihag提到可以保留原来的名称,这看起来很正常,但是文件不是在任何地方创建的,/Python/done/文件夹是空的。 一般来说,我不能工作。在

pi@raspberrypi ~/Python/done $ sudo youtube-dl --o '/Python/done/%(title)s-%(id)s.%(ext)s' https://www.youtube.com/watch?v=KA3Q1duzwaE
[youtube] KA3Q1duzwaE: Downloading webpage
[youtube] KA3Q1duzwaE: Downloading video info webpage
[youtube] KA3Q1duzwaE: Extracting video information
[download] Destination: /Python/done/Matre Gims - Tu vas me manquer (Clip Officiel)-KA3Q1duzwaE.f248.webm
[download] 100% of 34.98MiB in 00:12
[download] Destination: /Python/done/Matre Gims - Tu vas me manquer (Clip Officiel)-KA3Q1duzwaE.f251.webm
[download] 100% of 4.06MiB in 00:01
[ffmpeg] Merging formats into "/Python/done/Matre Gims - Tu vas me manquer (Clip Officiel)-KA3Q1duzwaE.webm"
Deleting original file /Python/done/Matre Gims - Tu vas me manquer (Clip Officiel)-KA3Q1duzwaE.f248.webm (pass -k to keep)
Deleting original file /Python/done/Matre Gims - Tu vas me manquer (Clip Officiel)-KA3Q1duzwaE.f251.webm (pass -k to keep)
pi@raspberrypi ~/Python/done $ dir

如果我再试一次,我会告诉你已经下载了

WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] /Python/done/test4.mkv.mkv has already been downloaded and merged

语法错误吗?在


Tags: clipyoutubedownloadfilemedldonewebm

热门问题