Me, myself and Youtube

No Comments

Ever looked at Youtube videos and thought, "I will always remember this, this is so funny!", only to realize a week after, you have no idea what it was out of the millions of lolcats you've seen?

There are a gazillion plug-ins for various pieces of software to save Youtube videos and since none of those are what I want (because I didn't bother to look?), here's my 2 cents.

Warning: Techie stuff starts here. If you don't know what nodejs is and running a service is a weird concept for you, please leave, look at some fucking dandelions and be happy.

For those prepared, the code is split in two pieces:

  • Server - nodejs with expressjs and ytdl modules required
  • Client - A JavaScript snippet that is used as a bookmark

Installation:

  • 1. Install nodejs, use your package manager or download nodejs
  • 2. Install nodejs modules expressjs and ytdl by executing the following commands in terminal/console:
    • npm install express
    • npm install ytdl
  • 3. Copy the server source to a file on your server and modify port (line 17) and homepath (line 20) variables accordingly

  • 4. Start the server by typing node app.js (this is for just testing, make a service out of it, e.g. with forever)

  • 5. Copy the client JS code and create a new bookmark with it as the address/target field
  • Ready. You go to Youtube, find the video you want and click the bookmark. Now the service gives you an alert box with info of what happened (also logged as stdout). If everything went OK, the file now is in the path you defined. There is no debugging, so if you run in to problems, please sort them out, kthxbye.

    Get the code from git or install it via npm.