cpl*_*lus 9 python youtube video batch-file
我使用youtube-upload中的脚本通过命令行将视频上传到我的频道.
如何运行代码来处理特定文件夹中的所有文件?
一旦我在网上看到一个例子,展示了如何使用相同的脚本批量上传视频到youtube,还从csv excel文件中获取标题,类别,描述和标签,每个文件都来自与另一个文件名对应的列柱.我忘了保存这个例子,现在我似乎无法找到它或者自己创建它.
顺便说一句,我在Windows 10环境下,使用命令行工具.
上传单个视频,我正在使用这个脚本;
youtube-upload \
--title="A.S. Mutter"
--description="A.S. Mutter plays Beethoven" \
--category=Music \
--tags="mutter, beethoven" \
--recording-date="2011-03-10T15:32:17.0Z" \
--default-language="en" \
--default-audio-language="en" \
--client-secrets=client_secrets.json \
--credentials-file=client_secrets.json \
test.mp4
Run Code Online (Sandbox Code Playgroud)
csv文件将具有与youtube-upload命令中的参数相同的列数.比方说,只会有标题,描述,类别,标签列,当然第一列将是文件名,如果需要,我还会添加文件的位置.
:: == ASSUMPTIONS ==
:: - this script is in the same directory as your CSV file
:: - your CSV lines are in the following order:
:: file_name;title;description;category;tags;recording_date
:: - Your descriptions do not contain semicolons
@echo off
set video_folder="C:\path\to\your\video\folder"
:: If your videos and csv file are in the same directory, you don't need the pushd or popd
:: Also, I couldn't get line continuation to work inside of the for loop, so everything
:: MUST be all on the same line.
pushd %video_folder%
for /f "tokens=1-6 delims=;" %%A in (vids.csv) do (
youtube-upload --title="%%~B" --description="%%~C" --category="%%~D" --tags="%%~E" --recording-date="%%~F" --default-language="en" --default-audio-language="en" --client-secrets=client-secrets.json --credentials-file=client_secrets.json "%%~A"
)
popd
pause
Run Code Online (Sandbox Code Playgroud)