python - Youtube上传api
问题描述
这里有人有使用 YouTube API 的经验吗?我目前正在尝试通过使用 OAuth 应用程序来自动上传我的视频,但是,由于它没有经过验证,我的视频会立即被锁定并设置为私有。由于没有网站,我无法验证我的 OAuth 应用程序。
有没有其他方法可以在不使用 OAuth 应用程序的情况下做到这一点?
def uploadClip(clip):
# Disable OAuthlib's HTTPS verification when running locally.
# *DO NOT* leave this option enabled in production.
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
api_service_name = "youtube"
api_version = "v3"
client_secrets_file = "client_secrets.json"
# Get credentials and create an API client
flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(client_secrets_file, scopes)
credentials = flow.run_console()
youtube = googleapiclient.discovery.build(api_service_name, api_version, credentials=credentials)
request = youtube.videos().insert(
part="snippet,status",
body={
"snippet": {
"categoryId": "22",
"description": ".",
"title": "H "
},
"status": {
"privacyStatus": "public"
}
},
# TODO: For this request to work, you must replace "YOUR_FILE"
# with a pointer to the actual file you are uploading.
media_body=clip
)
response = request.execute()
解决方案
推荐阅读
- vue.js - Kendo-Vue 隐藏列中的按钮?
- python - 使用 pip 安装 pygame 时出现错误消息
- reactjs - 如何硬编码简单的身份验证(无后端)并重定向到主页 - React
- mysql - 使用 Join 时如何选择不同的记录?
- regex - Splunk 正则表达式以匹配部分 url 字符串
- c# - 如何使用 FIFO 堆栈解决这一挑战?
- confluent-platform - 无法在 Confluent Cloud Basic 中创建多个服务帐户
- vue.js - 如何使用 Gitlab 将 Git 提交哈希注入 Vue 应用程序?
- sql - 将结果输出到管道分隔格式添加额外空间
- android - “无法从资产 'index.android.bundle' 加载脚本。确保...”