Python Youtube视频上传文件

时间:2019-05-12 14:36:44

标签: python google-api youtube-api google-api-python-client

无法确定视频的定义方式

  

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)

0 个答案:

没有答案