Using Google API v3 php library . I want the user to upload videos on my youtube channel. But oAuth require user google login and the video uploaded to the logged in user youtube channel.
Before using the V3 api we used the V2 to upload the video and it works well.
global $youtube_api_key, $youtube_username, $youtube_password;
if(is_file('../uploader/ClassYouTubeAPI.php')){ include_once ('../uploader/ClassYouTubeAPI.php'); }
else{ include_once('ClassYouTubeAPI.php'); }
$obj = new ClassYouTubeAPI($youtube_api_key);
$result = $obj->clientLoginAuth($youtube_username, $youtube_password);
$result = $obj->uploadVideo($uploaded_file_name, $file_path, $title, $description, $privacy);
var_dump($result);
if (is_array($result) and count($result) and ! isset($result["is_error"])) {
$youtube_file = str_replace($uploaded_file_name, $result["videoId"] . '.youtube', $file_path);
$resource = fopen($youtube_file, 'w');
fwrite($resource, "");
fclose($resource);
@unlink($file_path);
return $result["videoId"];
} else {
@unlink($file_path);
return false;
}
Is there any way to use the V3 without 'User Google Account' and upload the video to my channel?
There is only one solution, described here.
In short, you must create a "web application" account (not a "service account") in Google console and do authentication from your server on behalf of your YouTube account.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With