首页 > 解决方案 > Python Youtube 视频上传文件

问题描述

无法找出视频的定义方式

video = "/Users/mac/Desktop/Sam/video.avi"

我想运行并安装此代码

import os
import google_auth_oauthlib
import googleapiclient.discovery
import googleapiclient.errors

scopes = ["https://www.googleapis.com/auth/youtube.readonly"]

def main():
    os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"

    api_service_name = "youtube"
    api_version = "v3"
    client_secrets_file = "client_secret.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.liveBroadcasts().list(

    )
    response = request.execute()

    print(response)

标签: pythongoogle-apiyoutube-apigoogle-api-python-client

解决方案


推荐阅读