Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Insert video results in: HttpError 400 when requesting

$
0
0

I want to upload video in youtube channel from python but when i exicute my code i am getting this error

googleapiclient.errors.HttpError: <HttpError 400 when requesting https://youtube.googleapis.com/upload/youtube/v3/videos?notifySubscribers=false&prettyPrint=true&alt=json&uploadType=multipart returned "'snippet'". Details: "[{'message': "'snippet'",'domain': 'youtube.part', 'reason': 'unexpectedPart', 'location': 'part', 'locationType': 'parameter'}]">

Code

import osimport google_auth_oauthlib.flowimport googleapiclient.discoveryimport googleapiclient.errorsfrom googleapiclient.http import MediaFileUploadscopes = ["https://www.googleapis.com/auth/youtube.upload"]def index():    os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"    api_service_name = "youtube"    api_version = "v3"    client_secrets_file = "CLIENT_SECRET_FILE.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",       notifySubscribers=False,       prettyPrint=True,       body={"id" : "UC5St2PrRiL37g4MP-CPmVAA","snippet": {"categoryId": "19","title": "Upload Testing","description": "Hello World Description","tags": ["Travel","video test","Travel Tips"               ]           },"status": {"privacyStatus": "private","selfDeclaredMadeForKids": False          }       },        media_body=MediaFileUpload("wheat-field.mp4")   )   response = request.execute()print(response)

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>