问题描述
我的任务目标是创建一个控制台脚本,它将我自己网站上最近上传的视频插入我自己的 Youtube 频道.我想使用服务器到服务器的身份验证,但 YoutubeApi 现在不支持这种身份验证方式.
The goal of my task is to create a console script, which will insert recently uploaded videos on my own site to my own Youtube channel. I want to use server-to-server authentication but YoutubeApi does not support this way of authentication now.
所以我的问题是:如何在没有用户帮助的情况下使用 oauth2 身份验证和控制台脚本将视频上传到 youtube 频道?有没有办法在不使用已弃用的 ClientLogin 身份验证协议的情况下做到这一点?
So my question is: How could I upload video to youtube channel, using oauth2 authentication with console script without any help of a user? Is there any way to do this without using deprecated ClientLogin authentication protocol?
推荐答案
是的,这部分解释了如何:https://developers.google.com/youtube/v3/guides/moving_to_oauth#standalone
Yes this segment explains how to: https://developers.google.com/youtube/v3/guides/moving_to_oauth#standalone
基本上,您只需检查一次并从那里保存令牌.
Basically, you go through once and save the token from there.
如果您也想跳过那一次,您可以在 OAuth2 Playground 中获取刷新令牌使用受尊重的范围并将其直接插入您的代码中,并带有客户端密码和 ID.这样你的脚本就不需要网络浏览器了.
If you even want to skip that one time as well, you can get a refresh token in OAuth2 Playground with respected scopes and plug it in directly in your code, with client secret and id. That way your script won't need a web browser.
这是逐步解释此工作流程的视频.
这篇关于使用 YoutubeApi v3 和 ouath2 将视频上传到我的 Youtube 频道,无需用户身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!