I would like to automatize this process:

Upload in private mode all selected videos on YouTube channel, then embed it on a private blogspot blog with the setting: no related videos, play in HD, custom width of 1500 by 1150 (or just custom width X where X is width and then the height is automatically adjusted.)

I want it embedded on a private blog because if you watch it in the YouTube channel, it'll show related videos which are often junk that you couldn't care less for.

But I have no programming knowledge. Instead of trying to teach myself programming, I thought it would be more efficient to have some programmer teach via YouTube video how to do this.

Anyone?

Recommended Answers

All 11 Replies

Wow only 5 views...

Member Avatar for diafol

If you have no coding knowledge, using YouTube APIs may be beyond you. Difficult to see how you'll get this to work unless you learn how to code. There is also a blogger data api. I assume you'd have to use both of these to create a script. However, YT takes time to convert and index a video, which may be too long to create a post w/ video in blogger. You'd probably need some ajax jiggery pokery. Never tried it, so can't say more than that.

Member Avatar for cuonic

Yup I tried using the Youtube gData APIs and found that stuff too complicated with the authentication etc... Just too many different steps to go through.

Member Avatar for diafol

With you there cuonic. That OAuth stuff almost fried my brain. :)

If you have no coding knowledge, using YouTube APIs may be beyond you. Difficult to see how you'll get this to work unless you learn how to code. There is also a blogger data api. I assume you'd have to use both of these to create a script. However, YT takes time to convert and index a video, which may be too long to create a post w/ video in blogger. You'd probably need some ajax jiggery pokery. Never tried it, so can't say more than that.

Could you try it and make a screenshots tutorial on how to do it for somebody who has no experience in coding?

I don't see what's the problem with YT taking time, can't you just wait until you can access your videos?

Member Avatar for diafol

Did I get you right? You want me to do it for you and create screenshot tutorial for you?

Have you tried it yourself? Seeing as it's your project, why don't you create the screenshot tutorial?

Did I get you right? You want me to do it for you and create screenshot tutorial for you?

Have you tried it yourself? Seeing as it's your project, why don't you create the screenshot tutorial?

But I don't know programming so it would take you a lot less time and it is good for everyone because this way you can have free storage of all your videos of your family without storing them on your personal hard drives which can fail and lead to irreparable loss of important videos.

Member Avatar for diafol

Ha ha ha. Nice one freebee. As it happens I couldn't give a flying fig about uploading videos, but at least you brought a smile to my face. :)

Hi,

This may not be the direct answer to the question. However, this is how much you have to write just to send query to youtube using their API. I wrote different types and flavors of this.

It is my day off today and I am just lazy to actually write a more complicated example accessing youtube for upload from a remote server. It can be done.


You can also do a player targeting without refreshing a page as shown here in my old experiment for a client.

<?php
## script was written by PoorBoy from veedeoo.com/forum
## no warranty of any kind, so please don't even bother asking
## Can help during my freetime, but still no guarantee.
#### First we need a function fot get youtube video id
function getPatternFromUrl($url)
{
$url = $url.'&';
$pattern = '/v=(.+?)&+/';
preg_match($pattern, $url, $matches);
//echo $matches[1]; die;
return ($matches[1]);
}
## function above we will use later

## define our query for youtube
$query = "ac+dc";
## define the order by published or viewCount
## viewCount is case sensitive
## you can also do the publisher or author only, read the youtube API about this
$order ="published";
## define start index. Youtube allows you query 50 videos per page, but no more that 1000 per $query
## lets define start index to be 1 . Depending on the result of the query this should return at least 1000/50 = number of pages 
$s_page = 1;
## let's define the number of results we want to show on the page
## Like I said above max is 1000 and it is break down into 50 videos per $s_page.
$nvideos_max = 50;
## define format type format 5 is for the videos where the publishers that allows their videos to be embedded.
$format = 5 ;
## private videos is not going to be included in the result. Unless you want to spend a buck or two I can write it for you.

$yt_videoq = "http://gdata.youtube.com/feeds/api/videos?q=$query&orderby=$order&start-index=$s_page&max-results=$nvideos_max&v=2&format=$format";

## now lets's read the videoq feeds.
$yt_xml = simplexml_load_file($yt_videoq);
## we can show in list table whatever you want.
echo '<ul style="list-style: none;padding: 0; margin:0px auto;width:750px;">';
## let's get the feed and loop through the result
foreach ($yt_xml->entry as $veedeoo) {
$yt_media = $veedeoo->children('http://search.yahoo.com/mrss/');
##we need video player url
$p_attrs = $yt_media->group->player->attributes();
$p_url = $_attrs['url']; 
## the above contains the video id
## we need to extract it
## below will retun video id based on the function we wrote above.
$v_id = getPatternFromUrl($p_url); 
$video_id = $v_id;
## leave the $v_id for now, but we will come back to it later
## lets pick up the thumbnails attribute
$t_attrs = $yt_media->group->thumbnail[2]->attributes();
## this is our thumbnail url.
$thumbnail = $t_attrs['url']; 
## thumb above is fine, but I want the largest of all from ytube
## I must do this to get to the 0.jpg
$thumbnail = substr($thumbnail, 0,-4);
## now I have my big thumbs I can use it by
$thumbs = $thumbnail.".jpg";
## we need to get the title and description of the videos..there are more options here, but I will only cover title descriptions
$yt = $yt_media ->children('http://gdata.youtube.com/schemas/2007');
$title = $yt_media->group->title;
## this is optional but it is ok if will be stored in database. We need to clean the title a littel. You need to sanitize them throughly for db.
$title = preg_replace('/[^a-zA-Z0-9 ]/s', ' ', $title);
## we want a shorter title, but you can always show the full title by removing the codes below
$title =(substr($title, 0,20)).'...';
## let's pick up description
$description = $yt_media->group->description;
## some video descriptions on youtube are extremely long, so maybe we can truncate them to 50 characters, but it is all up to you.
$description =(substr($description, 0,50)).'...';
$description = str_replace( "\n", "", $description );
## do a minor cleaning on description
$description = preg_replace('/[^a-zA-Z0-9 ]/s', ' ', $description);
## if we want to pick the video keywords, we can do so by doing so
$tags = $yt_media->group->keywords;
$tags = preg_replace('/[^a-zA-Z0-9 ]/s', '', $tags);
## some tags are extremely long
$tags =(substr($tags, 0,20)).'...';
## let's pull the publishers username.. we must always give credit to the publishers
$credit = $veedeoo->author->name;

## let's show all the thumb in <li>
## you can put form or whatever means of processing to be able to import these videos.
?>
<!-- you can style them in separate css file to fit your needs -->
<li style="display: inline; float: left; padding:5px; width:165px;" >
<img width="100" height="100" src="<?=$thumbs?>" /><br/>
<b>Title: </b> <?=$title?><br/>
<b>Description: </b> <?=$description?><br/>
<b>Tags: </b> <b><?=$tags?></b><br/>
</li>
<?
}

?>

This is just an update just in case someone is following my post above. If you get an error similar to this

Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /……../ on line (..)

The temptation is great to turn the allow_url_include to on. DON'T DO IT for security reason. You only turn this thing to on when there is no other way.

The solution is this..lets create another funtion and just add it above line 6

function get_ytube($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)');  
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch); 

$xml = @simplexml_load_string($output);
return $xml;  
}

and then on line 35 $yt_xml = simplexml_load_file($yt_videoq);

change it to

$yt_xml = get_ytube($yt_videoq);

That should work without putting your server into so much risks....

But I don't know programming so it would take you a lot less time and it is good for everyone because this way you can have free storage of all your videos of your family without storing them on your personal hard drives which can fail and lead to irreparable loss of important videos.

Learn to program first and then move into doing programming projects!
http://www.w3schools.com/php/default.asp

commented: my thoughts exactly :) +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.