user2748797
user2748797

Reputation: 43

Youtube Upload to own account

I'm trying to upload a video to my Youtube to my account using the API but I can't find a way to do it easily. All the methods I saw require me to authenticate with oAuth in a browser.

I simply want to upload a video from a script to one account using a username and password or dev key or similar without going through the crazy, overly complex authentication methods. The script will run in a private in environment so security is not a concern.

Upvotes: 4

Views: 1863

Answers (5)

holybull
holybull

Reputation: 2026

youtube-upload is a really nice tool which you can make heavy usage out of it. This video shows you how to upload videos on your Youtube channel using youtube-upload.

Upvotes: 0

Kappaluppa
Kappaluppa

Reputation: 333

Try YouTube Upload Direct Lite. It is really easy to set up. https://code.google.com/p/youtube-direct-lite/

"Adding YouTube Direct Lite is as simple as adding an iframe HTML tag to your existing web pages. There is no server-side code that needs to be configured or deployed, though we do recommend that you check out your own copy of the YouTube Direct Lite HTML/CSS/JavaScript and host it on your existing web server. "

Upvotes: 0

Alex Tickie
Alex Tickie

Reputation: 11

Using ZEND, theres is a method, but it's deprecated by google: the client login.

Even you tag your question with pyton, I think this PHP example can helps you to give and idea

<?php
/*First time, first: start the session and calls Zend Library. 
Remember that ZEND path must be in your include_path directory*/

session_start();

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

$authenticationURL= 'https://accounts.google.com/ClientLogin';
$httpClient =
Zend_Gdata_ClientLogin::getHttpClient(
$username = '[email protected]',
$password = 'mypassword',
$service = 'youtube',
$client = null,
$source = 'My super duper application',
$loginToken = null,
$loginCaptcha = null,
$authenticationURL);

 //Now, create an Zend Youtube Objetc
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);


  // create a new video object
  $video = new Zend_Gdata_YouTube_VideoEntry();
  $video ->setVideoTitle('Test video');
  $video ->setVideoDescription('This is a test video');
  $video ->setVideoCategory('News'); // The category must be a valid YouTube category

//Will get an one-time upload URL and a one-time token

  $tokenHandlerUrl = 'http://gdata.youtube.com/action/GetUploadToken';
  $tokenArray = $yt->getFormUploadToken($myVideoEntry, $tokenHandlerUrl);
  $tokenValue = $tokenArray['token']; //Very important token, it will send on an hidden input in your form
  $postUrl = $tokenArray['url']; //This is a very importan URL

  // place to redirect user after upload
  $nextUrl = 'http://your-site.com/after-upload-page'; //this address must be registered on your google dev

  // build the form using the $posturl and the $tokenValue
  echo '<form action="'. $postUrl .'?nexturl='. $nextUrl .
          '" method="post" enctype="multipart/form-data">'.
          '<input name="file" type="file"/>'.
          '<input name="token" type="hidden" value="'. $tokenValue .'"/>'.
          '<input value="Upload Video File" type="submit" />'.
          '</form>';   
?>

I really hope this will be helpful. ¡Have a great day!

Upvotes: -1

Ibrahim Ulukaya
Ibrahim Ulukaya

Reputation: 12877

OAuth2 authorization let's you get a refresh token once the user authorize the upload. So you can get that token form OAuth2 playground manually for "https://www.googleapis.com/auth/youtube.upload" scope, save it and have a script to get access token periodically. Then you can plug in that access token to upload.

To sum up, browser interaction is required once, and you can do that through playground and save the token manually.

Upvotes: 0

neiesc
neiesc

Reputation: 653

try:

youtube-upload

django-youtube (if you use django)

Uploading videos

Upvotes: 2

Related Questions