google-api-python-client
google-api-python-client copied to clipboard
Confusion around how to upload a video to a specific channel
I'm trying to upload a video to a specific channel, on which I'm a manager.
This is how the upload code looks right now:
def upload_video(video_file: Path, args: UploadVideoArgs) -> str:
access_token = _get_access_token()
credentials = Credentials(access_token)
youtube_service = build('youtube', 'v3', credentials=credentials)
request_body = {
"snippet": {
"title": args['title'],
"description": args['description'],
"tags": args['tags']
},
"status": {
"privacyStatus": "private" # public, private, or unlisted
}
}
media = MediaFileUpload(video_file.resolve(), chunksize=-1, resumable=True, mimetype="video/mp4")
request = youtube_service.videos().insert(
part='snippet,status',
body=request_body,
media_body=media)
response = request.execute()
print("Video uploaded successfully! Video ID:", response["id"])
return response["id"]
The upload works without a problem, but it uploads the video to my own channel, instead of the channel that I'm managing. The client_secrets.json file was given to me from the company as well. How can I upload it to a specific channel?