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

Youtube Data API v3 uploading videos to a shared channel

$
0
0

The following Python script uploads a mp4 file to a Youtube channel through the Youtube Data API v3. The account gets identified with OAuth2 and uses a token as well as a refresh token. It works fine so far, so a user can upload a video into his own Youtube channel.

But I would like to rewrite the script so that the logged in user uploads the mp4 file not to his own Youtube channel, but instead to a channel where he has also access to. Is that even possible with the Youtube Data API v3?

creds = Credentials(    token=token,     refresh_token=refresh_token,     client_id=client_id,     client_secret=client_secret,     token_uri="https://oauth2.googleapis.com/token",    scopes=['https://www.googleapis.com/auth/youtube'])youtube = build('youtube', 'v3', credentials=creds)body=dict(    snippet=dict(        title=title,        description=description,        tags=["tag1", "tag2", "tag3"],        categoryId=str(category)    ),    status=dict(        privacyStatus="private"    ))media = MediaIoBaseUpload(    io.BytesIO(file),     mimetype='video/mp4',     chunksize=-1,     resumable=True)try:    youtube.videos().insert(        part=",".join(body.keys()),        body=body,        media_body=media,    ).execute()except HttpError as error:    print(F'An error occured: {error}')

Viewing all articles
Browse latest Browse all 3712

Latest Images

Trending Articles



Latest Images

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