通过命令行python将视频批量上传到youtube [英] batch upload videos to youtube via command line python

查看:650
本文介绍了通过命令行python将视频批量上传到youtube的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 youtube-up 中的脚本通过以下命令将视频上传到我的频道
如何运行代码以处理特定文件夹中的所有文件?
我在网上看到一个示例后,展示了如何使用相同的脚本将视频批量上传到youtube,以及如何从csv excel文件中获取标题,类别,说明和标签,每个标题,类别,说明和标签都来自与另一个文件名相对应的列柱子.我忘记保存此示例,现在似乎找不到或独自创建它.

顺便说一句,我在Windows 10环境中,使用命令行工具.

I am using the script from youtube-upload to upload videos to my channel via the command line.
How can I run the code to process all files in a specific folder(s)?
Once I saw an example on the net, showing how to batch upload videos to youtube using this same script, and also getting the titles, categories, description and tags from a csv excel file, each from a column corresponding to the file name in another column. I forgot to save this example and now I can't seem to find this or create it on my own.

by the way, I am on windows 10 environment, using the command line tool.

我正在使用此脚本来上传单个视频;

to upload single video, I am using this script;

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

更新

csv文件的列数与youtube-upload命令中的参数数相同.假设只有标题,描述,类别,标签列,当然第一列将是文件名,如果需要,我还将添加文件的位置.

update

the csv file will have the same number of columns as I will have parameters in the youtube-upload command. Let's say, there will be title, description, category, tags columns only, and of course the first column will be the file name, if needed, I will also add the location of the file.

推荐答案

:: == 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

这篇关于通过命令行python将视频批量上传到youtube的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆