Upload a video to youtube

Upload a video to youtube

$ google youtube post --title \"My Video\" --category Education ~/myvideo.avi Google just released a new commend line tool offering all sorts of new services from the commend line. One of them is uploading a youtube video but there are plenty more google services to interact with.

Download it here: http://code.google.com/p/googlecl/

Manual: http://code.google.com/p/googlecl/wiki/Manual

by David Winterbottom (codeinthehole.com)

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/JXJj-wy4keA/upload-a-video-to-youtube


Script to download all the related videos from youtube with youtube-dl

Lets cut the long discussion short and directly give you the script. The script is combination of all the posts that I did in the past about youtube downloads. You need to copy all the URL\’s in a file called \”~/youtube.urls\” which you want to be downloaded. Or if you need to donwload the related videos, then save the html of the page and give it as the first argument for the script. So, here\’s the scrit:

#!/bin/bash –
#          FILE:  youtube_releated.sh
#         USAGE:  ./youtube_releated.sh
#   DESCRIPTION:  Get the related urls from the youtube html
#       OPTIONS:  —
#          BUGS:  —
#         NOTES:  —
#        AUTHOR:  Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  05/02/2010 04:45:54 PM IST
#      REVISION:  —
if [  $# -ge 1 ]
for i in $(grep video-list-item $1 |sed \’s/&.*//\’|sed \’s/.*=\”\\(.*\\)/\\1/\’)
echo \”Writing $i to youtube.urls file\”
echo \”http://www.youtube.com$i\” >> ~/youtube.urls

read -p \”Download all the urls :\” ans

cd ~

if [ \”$ans\” = \”y\” ]
grep -v \”^#\” ~/youtube.urls > /tmp/youtube.urls
while read line
youtube-dl -u $user -p $pass -t $line
done < /tmp/youtube.urls

read -p \”Add title to the file :\” ans1

if [ \”$ans1\” != \”y\” ]
rm -f /tmp/youtube.urls

while read line
echo $line|grep -c \”^#\”
if [ $(echo $line|grep -c \”^#\”) -eq 1 ]
echo \”#$line\” >>/tmp/youtube.urls
echo \”Skipping $line\”
title=$(youtube-dl -u $user -p $pass -e $line)
echo \”title is $title\”
done <~/youtube.urls

mv /tmp/youtube.urls ~/youtube.urls

Since the script is quite simple, its not much documented. Anyways if you need help, feel free to contact me 🙂 (contact form or comment)


Download youtube video directly from the command line with youtube-dl

If you keep searching for applications to download the youtube videos or you keep searching for the firefox addons to download the embedded the video, then this is for you. Ofcouse that is the case, only if you do not want to copy it after you have watched it in the browser :). If you have already watched it then you can copy it from the Firefox cache. I will post on that later for now lets see youtube-dl.

Lets download it first:

sudo yum install youtube-dl

Now when you want to download a video then all you need to do is

youtube-dl URL

This will work only if you can watch without logging in to your account, if you need to login then you should provide your username and password, like so:

youtube-dl -u username -p password URL

The problem with this is that the file will be saved with not so useful name. If you want to save the file with appropriate name then you can save the file with the title name:

youtube-dl -t URL

There are few other options worth looking at, specially :

-f FMT, –format=FMT
video format code
-b, –best-quality  download the best quality video possible
-m, –mobile-version
alias for -f 17
-d, –high-def      alias for -f 22

If you have multiple url\’s to download then place all the url\’s in a file, and then use the command:

youtube-dl -a filename

Hope this is useful to you.