Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
670 views
in Technique[技术] by (71.8m points)

php - YouTube v3 API upload to channel

I have to migrate my PHP scripts using YouTube's v2 API to v3.

I'm trying this example to upload a video:

https://developers.google.com/youtube/v3/code_samples/php#resumable_uploads

I can authenticate my Google account for my app, the only problem is that the video is being uploaded to my Google+ YouTube channel and not to my original channel. (They both belong to the same Google account).

I was not able to solve this problem with the v2 API but selecting the "default" channel in "Channel switcher" (https://www.youtube.com/channel_switcher) did help.

How can I tell the v3 API which channel to upload to?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As of writing, the ability to choose which channel to upload a video to is only available to YouTube content partners.

The videos.insert method supports an optional parameter onBehalfOfContentOwnerChannel, which takes in a a YouTube channel ID value as a string. You must also provide your YouTube CMS auth credentials for the onBehalfOfContentOwner parameter as well.

YouTube provides some explanation:

This [onBehalfOfContentOwnerChannel] parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and perform actions on behalf of the channel specified in the parameter value, without having to provide authentication credentials for each separate channel.

Relevant API documentation for videos.insert here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...