Coder Social home page Coder Social logo

youtube-uploader's Introduction

This is a YouTube video uploader that works without any APIs. It just
simulates what a browser would do and takes all the steps to post the video
and set the video info.

It was written by Peteris Krumins ([email protected]).
His blog is at http://www.catonmat.net  --  good coders code, great reuse.

The code is licensed under the GPL license.

The code was written as a part of the article "How to Upload YouTube Videos
Programmatically" on my website. It's written in a tutorial style with
careful explanations of how the uploader works. Read the article here:

 http://www.catonmat.net/blog/how-to-upload-youtube-videos-programmatically/

------------------------------------------------------------------------------

How to use this program?
------------------------

The program is called "ytup.pl", short for "youtube upload". If you run it
without arguments, it will output its usage pattern:

    $ ./ytup.pl 
    Usage: ./ytup.pl -l [login]
                     -p [password]
                     -f <video file>
                     -c <category>
                     -t <title>
                     -d <description>
                     -x <comma, separated, tags>

Since YouTube is now part of Google services, you may specify your Google
login and password to -l and -p arguments.

If you don't want to expose your login and password as command line arguments,
you can also set them in the program as YT_LOGIN and YT_PASS constants.

-f is the path to video file, it can be relative path or absolute path, for
example, -f /home/pkrumins/video.avi. If the path to video contains spaces,
quote the video argument like this, -f "my video.avi".

-c is the category number you want your video to be classified in (see below
for all the possible categories). For example, "-c 10" would set category as
"Music".

-t is the title of the video. For example, -t "My cat video". You have to
quote the title.

-d is the description of the video. For example -d "My cat sleeping on a
couch". You have to use quotes around the description.

-x is a comma separated of tags. For example -x "cat, peteris, couch, sun".
Tags also have to be quotes.

Here is the list of possible categories (for -c switch):
    2    - Autos & Vehicles
    23   - Comedy
    27   - Education
    24   - Entertainment
    1    - Film & Animation
    20   - Gaming
    26   - Howto & Style
    10   - Music
    25   - News & Politics
    29   - Nonprofits & Activism
    22   - People & Blogs
    15   - Pets & Animals
    28   - Science & Technology
    17   - Sports
    19   - Travel & Places

Here is an example usage of the program:

    $ ./ytup.pl -l '[email protected]' -p 'my_password' -f ./videoclip.avi
                -c 2 -t "Auto race video" -d "Nascar auto race"
                -x "car, auto, nascar, race"

    Logging in to YouTube...
    Uploading the video (foo)...
    Done!


------------------------------------------------------------------------------

Have fun uploading your videos!

Sincerely,
Peteris Krumins
http://www.catonmat.net

youtube-uploader's People

Contributors

pkrumins avatar kost avatar

Stargazers

 avatar Vadim avatar  avatar  avatar Juri Grabowski avatar Sheldon Rupp avatar Jason McVeigh avatar  avatar Francois-Guillaume Ribreau avatar  avatar Rustam Salavatov avatar mgb avatar tengle1080 avatar Andrey Andrade avatar  avatar Giancarlo Angulo avatar Drew Taylor avatar HK4ADJ avatar

Watchers

 avatar Juri Grabowski avatar Thiago Ghilardi avatar  avatar  avatar

youtube-uploader's Issues

Login appears to have become broken.

Hi Peteris,

it seems that the script is now broken:

shlomif@telaviv1:~/progs/perl/www/web-automation/youtube/youtube-uploader$ bash 
Upload-Yon-Qatan.bash

Loading DB routines from perl5db.pl version 1.37
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

main::(./ytup.pl:11):   $|=1;
  DB<536> b 201
  DB<537> c
Logging in to YouTube...
main::login(./ytup.pl:201):         my $GALX = extract_field($res->content, qr/n
ame="GALX".+?value="([^"]+)"/s);
  DB<537> x $res->content
0  '<!DOCTYPE html><html><head><style>* { margin:0;padding:0;border:0}html,body{
height:100%;}</style><title>404 Not Found</title>
<!-- machid: nLThsU052OXJEdFZZOW5wLUF0OGNxU0ptQjF6YWozb3o1c21KUlppcGh1bFhRM1EyNW
tWVGZn -->
<!-- handler: channel -->

              </head><body><iframe style="display:block;border:0;" src="/error?s
rc=404&amp;ifr=1&amp;error=" width="100%" height="100%" frameborder="0" scrollin
g="no"></iframe></body></html>'
  DB<538> x $res->content
0  '<!DOCTYPE html><html><head><style>* { margin:0;padding:0;border:0}html,body{
height:100%;}</style><title>404 Not Found</title>
<!-- machid: nLThsU052OXJEdFZZOW5wLUF0OGNxU0ptQjF6YWozb3o1c21KUlppcGh1bFhRM1EyNW
tWVGZn -->
<!-- handler: channel -->

              </head><body><iframe style="display:block;border:0;" src="/error?s
rc=404&amp;ifr=1&amp;error=" width="100%" height="100%" frameborder="0" scrollin
g="no"></iframe></body></html>'
  DB<539> n
main::login(./ytup.pl:202):         unless ($GALX) {
  DB<539> n
main::login(./ytup.pl:203):             die "Failed logging in. Unable to extrac
t GALX identifier from Google's login page.";
  DB<539> n
Failed logging in. Unable to extract GALX identifier from Google's login page. a
t ./ytup.pl line 203.
 at ./ytup.pl line 203.
        main::login() called at ./ytup.pl line 186
Debugged program terminated.  Use q to quit or R to restart,
  use o inhibit_exit to avoid stopping after program termination,
  h q, h R or h o to get additional info.  

Upload-Yon-Qatan.bash is:

#!/bin/bash
perl -d ./ytup.pl -l '[email protected]' -p 'MY_PASSWORD' \
    -f '/home/shlomif/Docs/Images/Videos/Yonathan-Haqatan-From-MOD/yonqatan.ogv' \
    -c 10 -t "Yonathan Haqatan (Little Jonathan) - Techno version (from MOD" \
    -x 'yonathan, haqatan, יונתן הקטן, nursery rhyme, crossover, israel, israeli, german, MOD, module, files, hakatan, crossover, techno, dance' \
    -d $'This is a dance/techno version of a cliché Israeli nursery rhyme
called “Yonathan Haqatan” (or Little Jonathan in English), which is one of the
first songs that Israeli music learners learn. It is based on this MOD file -
http://modarchive.org/index.php?request=view_by_moduleid&query=62919 that my
friend and I prepared, when we were in high school. It is possible the
Israeli version is based on an old German tune.

The background photograph is from http://commons.wikimedia.org/wiki/File:Nursery_Rhymes_pg_7.jpg and is under the public domain.
'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.