Youtube-upload is a command line script that using to upload a videos to your youtube account. This tool runs using Python

Where to download

click here to download youtube-upload

$ tar xvzf youtube-upload-VERSION.tgz
$ cd youtube-upload-VERSION
$ sudo python setup.py install

Dependencies

Before installing youtube-upload tool you must need to install  Python 2.6 or 2.7 and Python-gdata(>=1.2.4)

without installing python-gdata you get error like this

Traceback (most recent call last):
 File "setup.py", line 3, in 
 from youtube_upload import VERSION
 File "/home/vinoth/youtube_upload/youtube-upload-0.7.3/youtube_upload/__init__.py", line 1, in 
 from youtube_upload import * 
 File "/home/vinoth/youtube_upload/youtube-upload-0.7.3/youtube_upload/youtube_upload.py", line 48, in 
 import gdata.media
ImportError: No module named gdata.media

install python-gdata

What is python-gdata?

Python-gdata – Google Data Python client library

  • Distribution: Ubuntu 14.04.2 LTS
  • Repository: Ubuntu Universe i386
  • Package name: python-gdata
  • Package version: 2.0.14-2
  • Package architecture: all
  • Package type: deb
  • Binary package: python-gdata_2.0.14-2_all.deb
  • Source package: python-gdata
  • Installed size: 2,93 MB
  • Download size: 447,12 KB
    The GData (Google data) APIs provide a simple protocol for reading and writing data on the web.
    Each of the following Google services provides a Google data API:
    Base, Blogger, Calendar, Code Search, Contacts, Document List, Google Apps Provisioning, Notebook, Picasa Web Albums, Spreadsheets & YouTube.
    The Google data Python client library provides a library and source
    code that make it easy to access data through Google data APIs.
$sudo apt-get update
$sudo apt-get install python-gdata

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required: corosync libcfg6 libcmap4 libcorosync-common4 libcpg4 libibverbs1 libqb0
libquorum5 librdmacm1 libsam4 libtotem-pg5 libvotequorum6 libzookeeper-mt2
Use 'apt-get autoremove' to remove them.
Suggested packages: python-gdata-doc
The following NEW packages will be installed: python-gdata
0 upgraded, 1 newly installed, 0 to remove and 526 not upgraded.
Need to get 466 kB of archives.
After this operation, 2,856 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty/universe python-gdata all 2.0.18+dfsg-1 [466 kB]
Fetched 466 kB in 30s (15.1 kB/s)
Selecting previously unselected package python-gdata.
(Reading database ... 237282 files and directories currently installed.)
Preparing to unpack .../python-gdata_2.0.18+dfsg-1_all.deb ...
Unpacking python-gdata (2.0.18+dfsg-1) ...
Setting up python-gdata (2.0.18+dfsg-1) ...

python-gdata module installed successfully.

Then again run this command inside the folder of youtube-upload

$ sudo python setup.py install

running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/youtube_upload
copying youtube_upload/__init__.py -> build/lib.linux-x86_64-2.7/youtube_upload
copying youtube_upload/youtube_upload.py -> build/lib.linux-x86_64-2.7/youtube_upload
running build_scripts
creating build/scripts-2.7
copying and adjusting bin/youtube-upload -> build/scripts-2.7
changing mode of build/scripts-2.7/youtube-upload from 644 to 755
running install_lib
creating /usr/local/lib/python2.7/dist-packages/youtube_upload
copying build/lib.linux-x86_64-2.7/youtube_upload/__init__.py -> /usr/local/lib/python2.7/dist-packages/youtube_upload
copying build/lib.linux-x86_64-2.7/youtube_upload/youtube_upload.py -> /usr/local/lib/python2.7/dist-packages/youtube_upload
byte-compiling /usr/local/lib/python2.7/dist-packages/youtube_upload/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/youtube_upload/youtube_upload.py to youtube_upload.pyc
running install_scripts
copying build/scripts-2.7/youtube-upload -> /usr/local/bin
changing mode of /usr/local/bin/youtube-upload to 755
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/youtube_upload-0.7.3.egg-info

youtube upload tool is install successfully

Some Examples

$ youtube-upload --email=myemail@gmail.com --password=mypassword \
                 --title="A.S. Mutter" --description="A.S. Mutter plays Beethoven" \
                 --category=Music --keywords="mutter, beethoven" anne_sophie_mutter.flv
www.youtube.com/watch?v=pxzZ-fYjeYs

$youtube-upload --email=vc@gmail.com --password=****** --title="Myvideo" --description="$(my video )" --category=Music --keyword="MYvideo" sample.mp4

my: command not found
Login to Youtube API: email=vc@gmail.com', password='*********'
Start upload using a HTTP post: sample.mp4 -> https://uploads.gdata.youtube.com/action/FormDataUpload/AIwbFAQ5u5G6pVBOhu-HdaQgAJhyCtiFxnHaE9si15R-VNBIrF_ViGdN_z0WE--pdo8aEvsYdI-bBAoapjwyPA_tnKDMfEfODA
Install python-progressbar to see a nice progress bar
http://www.youtube.com/watch?v=pvhQbD-s_VA


$sudo pip install progressbar

Downloading/unpacking progressbar
 Downloading progressbar-2.2.tar.gz
 Running setup.py (path:/tmp/pip_build_root/progressbar/setup.py) egg_info for package progressbar
 
Installing collected packages: progressbar
 Running setup.py install for progressbar
 
Successfully installed progressbar
Cleaning up...

Thanks to Google code.

I hope you this blog is helpful for you 😀

One Reply to “Youtube video upload using ubuntu command line”

  1. youtube-upload fails

    $ youtube-upload
    Traceback (most recent call last):
    File “/usr/local/bin/youtube-upload”, line 9, in
    from youtube_upload import main
    File “/usr/local/lib/python2.7/dist-packages/youtube_upload/main.py”, line 24, in
    import googleapiclient.errors
    ImportError: No module named googleapiclient.errors

    any help?

Leave a Reply

Your email address will not be published. Required fields are marked *