commit 5c7359365f87a8032b9e91d9a50aa9990b9ebb46 Author: Ricardo Garcia Date: Sun Oct 31 23:50:48 2010 +0100 Initial pages commit, using the wiki contents diff --git a/faq.html b/faq.html new file mode 100644 index 000000000..a9a2616b6 --- /dev/null +++ b/faq.html @@ -0,0 +1,31 @@ + + +youtube-dl Frequently Asked Questions + + + +

youtube-dl Frequently Asked Questions

+ +

The program has stopped working. Please fix it.

+ +

First, that is not a question. Second, when reporting this type of issue please make sure you're using the latest version, and mention the version you're using in the bug report. You should also copy the command line you're using to call the program, and the program output so I can see how it fails and have an example of a specific video that's giving you problems.

+ +

The preferred method to report bugs is to write me an e-mail. You can find my address in the contact information page at rg03.wordpress.com. Together with this, you should check if there's a similar recent issue reported in the issue tracker. If you decide to open a new issue or post a comment in an existing issue, mention that in the e-mail as well. Writing me by e-mail lets me answer you directly and I have your contact information, so I can get back to you for more information or ask you to test a solution for your problem.

+ +

Can you please put the -b option back?

+ +

Most people asking this question are not aware that youtube-dl now defaults to downloading the highest available quality as reported by YouTube, which will be 1080p or 720p in some cases, so you no longer need the -b option. For some specific videos, maybe YouTube does not report them to be available in a specific high quality format you're interested in. In that case, simply request it with the -f option and youtube-dl will try to download it.

+ +

I get HTTP error 402 when trying to download a video. What's this?

+ +

Apparently YouTube requires you to pass a CAPTCHA test if you download too much. At this moment, there is no plan to solve this issue, as youtube-dl is a command line program that is many times used without X and in an unattended fashion, so there's no easy way of solving this, in my humble opinion. I have no plans to solve it at this moment, but let me know your ideas and code if you come up with something.

+ +

I have downloaded a video but how can I play it?

+ +

If you used youtube-dl to download a video and it wrote the video file to your hard drive, finishing with a completion message of 100%, the video is downloaded, so youtube-dl has finished its job and usually it's not to blame for problems that happen later. Not every video player supports FLV or MP4 files and every codec out there needed to play YouTube videos. In Linux, for example, I am generally pleased with MPlayer. In Windows, I tend to use VLC. Those usually work flawlessly.

+ +

Sometimes the program does not download the best quality format

+ +

This issue happens on YouTube and related to formats 34 and 18. Format 34 is, for many videos, 360p widescreen, and of higher quality than the same video in format 18. However, sometimes format 18 provides a better quality version, as format 34 appears to be just 240p for some videos. There is no plan to fix this. Currently the only way of finding out which version gives higher quality is to download a chunk of both formats and peek into the files themselves to find out, if you know how. As, in my experience, format 34 usually wins, and in many future videos uploaded in high definition formats it will be 360p, format 34 will remain as the format to download in case of doubt.

+ + diff --git a/generate-home b/generate-home new file mode 100755 index 000000000..3632535f5 --- /dev/null +++ b/generate-home @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import hashlib +import subprocess +import sys + +# Run command line and get output +def output(cmdline): + p = subprocess.Popen(cmdline, shell=True, stdout=subprocess.PIPE) + retval = p.communicate()[0] + p.wait() + return retval + +# Read template page +template = file('index.html.in', 'r').read() + +# Build replacement strings +version = output('cd ../master && git tag | tail -1').strip() +data = output('cd ../master && git show %s:youtube-dl' % version) +url = 'http://github.com/rg3/youtube-dl/raw/%s/youtube-dl' % version +md5sum = hashlib.md5(data).hexdigest() +sha1sum = hashlib.sha1(data).hexdigest() +sha256sum = hashlib.sha256(data).hexdigest() +template = template.replace('@PROGRAM_VERSION@', version) +template = template.replace('@PROGRAM_URL@', url) +template = template.replace('@PROGRAM_MD5SUM@', md5sum) +template = template.replace('@PROGRAM_SHA1SUM@', sha1sum) +template = template.replace('@PROGRAM_SHA256SUM@', sha256sum) +file('index.html', 'w').write(template) diff --git a/index.html b/index.html new file mode 100644 index 000000000..9d4c78dbf --- /dev/null +++ b/index.html @@ -0,0 +1,101 @@ + + +youtube-dl + + + +

youtube-dl: Download videos from YouTube.com

+ +
(and more...)
+ +

What is it?

+ +

youtube-dl is a small command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter, version 2.x (x being at least 4), and it's not platform specific. It should work in your Unix box, in Windows or in Mac OS X. The latest version is 2010.10.24. It's released to the public domain, which means you can modify it, redistribute it or use it however you like.

+ +

I'll try to keep it updated if YouTube.com changes the way you access their videos. After all, it's a simple and short program. However, I can't guarantee anything. If you detect it stops working, check for new versions and/or inform me about the problem, indicating the program version you are using. My contact information is at rg03.wordpress.com. If the program stops working and I can't solve the problem but you have a solution, I'd like to know it. If that happens and you feel you can maintain the program yourself, tell me.

+ +

Thanks for all the feedback received so far. I'm glad people find my program useful.

+ +

Usage instructions

+ +

In Windows, once you have installed the Python interpreter, save the program with the .py extension and put it somewhere in the PATH. Try to follow the guide to install youtube-dl under Windows.

+ +

In Unix, download it, give it execution permission and copy it to one of the PATH directories (typically, /usr/local/bin).

+ +

After that, you should be able to call it from the command line as youtube-dl or youtube-dl.py. I will use youtube-dl in the following examples. Usage instructions are easy. Use youtube-dl followed by a video URL or identifier. Example: youtube-dl "http://www.youtube.com/watch?v=foobar". The video will be saved to the file foobar.flv in that example. As YouTube.com videos are usually in Flash Video format, their extension should be flv. In Linux and other unices, video players using a recent version of ffmpeg can play them. That includes VLC, MPlayer, etc. Those two work under Windows and other platforms, but you could also get a specific FLV player of your taste.

+ +

If you try to run the program and you receive an error message containing the keyword SyntaxError near the end, it means your Python interpreter is too old.

+ +

More usage tips

+ +

The program is usually invoked as youtube-dl followed by options and the video URLs. Listing all the options here would make this text too long, so you can run youtube-dl --help and get a summary of them. From that point on you can start experimenting with the different options yourself. The most common ones are -t (or -l) to include the video title in the file name. Also, the -o option can specify the output file name and path. It allows special character sequences that can be used as templates to be replaced. See the "Output template" section for more details.

+ +

Download it

+ +

Note that if you directly click on these hyperlinks, your web browser will most likely display the program contents. It's usually better to right-click on it and choose the appropriate option, normally called Save Target As or Save Link As, depending on the web browser you are using.

+ +

2010.10.24

+ + + +

FAQ

+ +

The Frequently Asked Questions page contains answers to some common questions that pop up in my e-mail and in the issue tracker. Be sure to check it before reporting problems.

+ +

Supported sites

+ + + +

Proxy support

+ +

youtube-dl supports downloading videos through a proxy, by setting the http_proxy environment variable to the proxy URL, as in http://proxy_machine_name:port/.

+ +

YouTube formats

+ +

Using the -f option and other related options, you can specify the video format to be downloaded from YouTube. Instead of keeping a video format table here, I will refer you to the list of YouTube formats on Wikipedia.

+ +

Output template

+ +

The -o option allows users to indicate a template for the output file names. The basic usage is not to set any template arguments when downloading a single file, like in youtube-dl -o funny_video.flv "http://some/video". However, it may contain special sequences that will be replaced when downloading each video. The special sequences have the format %(NAME)s. To clarify, that's a percent symbol followed by a name in parenthesis, followed by a lowercase S. Allowed names are:

+ + + +

As you may have guessed, the default template is %(id)s.%(ext)s. When some command line options are used, it's replaced by other templates like %(title)s-%(id)s.%(ext)s. You can specify your own.

+ +

Authors

+ + + +
Copyright © 2006-2010 Ricardo Garcia Gonzalez
+ + diff --git a/index.html.in b/index.html.in new file mode 100644 index 000000000..d7c8f8aa7 --- /dev/null +++ b/index.html.in @@ -0,0 +1,101 @@ + + +youtube-dl + + + +

youtube-dl: Download videos from YouTube.com

+ +
(and more...)
+ +

What is it?

+ +

youtube-dl is a small command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter, version 2.x (x being at least 4), and it's not platform specific. It should work in your Unix box, in Windows or in Mac OS X. The latest version is @PROGRAM_VERSION@. It's released to the public domain, which means you can modify it, redistribute it or use it however you like.

+ +

I'll try to keep it updated if YouTube.com changes the way you access their videos. After all, it's a simple and short program. However, I can't guarantee anything. If you detect it stops working, check for new versions and/or inform me about the problem, indicating the program version you are using. My contact information is at rg03.wordpress.com. If the program stops working and I can't solve the problem but you have a solution, I'd like to know it. If that happens and you feel you can maintain the program yourself, tell me.

+ +

Thanks for all the feedback received so far. I'm glad people find my program useful.

+ +

Usage instructions

+ +

In Windows, once you have installed the Python interpreter, save the program with the .py extension and put it somewhere in the PATH. Try to follow the guide to install youtube-dl under Windows.

+ +

In Unix, download it, give it execution permission and copy it to one of the PATH directories (typically, /usr/local/bin).

+ +

After that, you should be able to call it from the command line as youtube-dl or youtube-dl.py. I will use youtube-dl in the following examples. Usage instructions are easy. Use youtube-dl followed by a video URL or identifier. Example: youtube-dl "http://www.youtube.com/watch?v=foobar". The video will be saved to the file foobar.flv in that example. As YouTube.com videos are usually in Flash Video format, their extension should be flv. In Linux and other unices, video players using a recent version of ffmpeg can play them. That includes VLC, MPlayer, etc. Those two work under Windows and other platforms, but you could also get a specific FLV player of your taste.

+ +

If you try to run the program and you receive an error message containing the keyword SyntaxError near the end, it means your Python interpreter is too old.

+ +

More usage tips

+ +

The program is usually invoked as youtube-dl followed by options and the video URLs. Listing all the options here would make this text too long, so you can run youtube-dl --help and get a summary of them. From that point on you can start experimenting with the different options yourself. The most common ones are -t (or -l) to include the video title in the file name. Also, the -o option can specify the output file name and path. It allows special character sequences that can be used as templates to be replaced. See the "Output template" section for more details.

+ +

Download it

+ +

Note that if you directly click on these hyperlinks, your web browser will most likely display the program contents. It's usually better to right-click on it and choose the appropriate option, normally called Save Target As or Save Link As, depending on the web browser you are using.

+ +

@PROGRAM_VERSION@

+ + + +

FAQ

+ +

The Frequently Asked Questions page contains answers to some common questions that pop up in my e-mail and in the issue tracker. Be sure to check it before reporting problems.

+ +

Supported sites

+ + + +

Proxy support

+ +

youtube-dl supports downloading videos through a proxy, by setting the http_proxy environment variable to the proxy URL, as in http://proxy_machine_name:port/.

+ +

YouTube formats

+ +

Using the -f option and other related options, you can specify the video format to be downloaded from YouTube. Instead of keeping a video format table here, I will refer you to the list of YouTube formats on Wikipedia.

+ +

Output template

+ +

The -o option allows users to indicate a template for the output file names. The basic usage is not to set any template arguments when downloading a single file, like in youtube-dl -o funny_video.flv "http://some/video". However, it may contain special sequences that will be replaced when downloading each video. The special sequences have the format %(NAME)s. To clarify, that's a percent symbol followed by a name in parenthesis, followed by a lowercase S. Allowed names are:

+ + + +

As you may have guessed, the default template is %(id)s.%(ext)s. When some command line options are used, it's replaced by other templates like %(title)s-%(id)s.%(ext)s. You can specify your own.

+ +

Authors

+ + + +
Copyright © 2006-2010 Ricardo Garcia Gonzalez
+ + diff --git a/style.css b/style.css new file mode 100644 index 000000000..ab31f686d --- /dev/null +++ b/style.css @@ -0,0 +1,25 @@ +body { + font-family: sans-serif; + margin-left: 10%; + margin-right: 10%; + margin-top: 2ex; + margin-bottom: 3ex; + background-color: white; + color: black; +} +.note { + text-align: center; + font-size: x-small; +} +h1 { + color: #006699; + text-align: center; + border: 1px solid #dddddd; + background: #eeeeee; +} +h2 { + color: #006699; +} +tt { + background: #dddddd; +} diff --git a/windows.html b/windows.html new file mode 100644 index 000000000..c549f54e0 --- /dev/null +++ b/windows.html @@ -0,0 +1,55 @@ + + +youtube-dl under Windows + + + +

youtube-dl under Windows

+ +

The following text explains how to run youtube-dl under Microsoft Windows. The first part describes some generic instructions about installing a command line program, followed by specific instructions on running youtube-dl.

+ +

Disclaimer

+ +

User nishad provides a standalone executable for youtube-dl. With it, you don't need the Python interpreter. In addition, he has created an optional graphical user interface to ease using the program. The following instructions apply if you want to install the official version of youtube-dl with the Python interpreter, and still apply if you want to install the standalone executable. In that case, you can skip the step of installing the Python interpreter.

+ +

His contributions can be downloaded from http://www.himili.com/blog/downloads/youtube-video-downloader/. If you use these versions and find a problem, contact him first. He will redirect real youtube-dl issues to me.

+ +

Preparing to install a command line program

+ +

The Windows command line interpreter is a program called cmd. It can be found somewhere in the applications menu, but many people prefer to run it by clicking on Start > Run and then typing cmd and pressing the enter key. It's very similar to the DOS command line interpreter, if you're old enough to remember it. When you launch it, it will be usually running at your home directory. It's C:\Documents and Settings\<username> usually, where <username> is your user name in that computer, and it will be waiting for you to input commands followed by the enter key. The text to the left of the cursor usually indicates the so-called current working directory, followed by a greater than (>) symbol. You can go up the directory hierarchy with the command cd .., change the current working drive letter by typing its name as a command, like D:, and you can go to a subdirectory (or subfolder, as Windows prefers to call it) by typing the command cd followed by its path, maybe using double quotes if the name contains spaces, like in cd "My Documents\My Porn\My Hardcore Orgies\Animals". Just kidding. The cd command stands for change [to] directory.

+ +

The goal here is to use youtube-dl.py as one of those system commands. The problem is that youtube-dl.py is a simple text file you will download from a webserver and will be stored in some obscure place in your hard drive. If you want to type youtube-dl.py in the command line interpreter and have it run the program, you will have to give the command line interpreter at least a clue about where to find the program, or it will find youtube-dl.py to be a meaningless name.

+ +

This is where the PATH environment variable is important. Environment variables are pairs of names and values that are available to any program that is running on the computer. This environment variable is specially useful for the command line interpreter, as its value is a list of folders where system commands and programs can be found. So what we will do is to create a personal folder where we can drop command line programs, and add that folder to the list of folders in the PATH environment variable.

+ +

So let's go to our home directory. Our home directory or folder is the one that contains folders such as My Documents or the Desktop folder. However, for some reason, Microsoft didn't make it simple to reach that directory. One would expect that going to the My Documents folder and going up one level, you'd reach the home directory, but that's not the case. The Windows explorer will take you to a different place if you go up from the My Documents folder. One straightforward way of going there is to click on Start > Run and typing explorer "%USERPROFILE%" literally, followed by the enter key. Once there, right click on an empty space and choose to create a new folder, giving it an appropriate name like Commands or something similar. Double click to enter the newly created folder, and don't close that explorer window yet.

+ +

Now click with the right mouse button on any My Computer icon, and choose Properties. There should be an Advanced Options tab, which has a Environment Variables button at the bottom, which you have to press. In the window that will be opened you can set your user or personal environment variables, and the system environment variables if you have enough security privileges. Modifying the personal environment variables will be enough for our case.

+ +

First, check to see if you have a PATH environment variable among your personal variables. Usually, you won't have it, so you'll have to create a new variable, with the name PATH, and use %USERPROFILE%\Commands, literally, as the variable value. Be careful when typing that and don't forget to change the word Commands to the appropriate name if you didn't use that name when creating the folder. In the case a PATH environment variable already exists, it should contain one or more directories or folders, separated by semicolon characters. In that case, simply append ;%USERPROFILE%\Commands at the end. Note the semicolon character used as a separator. It's also a good idea to create a personal variable named HOME with the value %USERPROFILE% at this moment. Finally, accept all the changes. Programs started from now on will have the new folder in the PATH environment variable.

+ +

Up to this point, we have created a Commands folder where we can drop command line programs and later use them in the command line interpreter, because the interpreter will be able to find them. These steps were all generic, and you can drop any command line program in there. In the next step, we'll drop youtube-dl.py in it.

+ +

Running youtube-dl.py

+ +

If the Python interpreter is not installed in your system, install it now. There is a download section in the previous webpage that lets you download a Windows installer to run Python programs. Remember you have to get version 2.x, with x being at least 4.

+ +

Now go to the youtube-dl webpage and download the program to your Windows Desktop. Under Windows, it's important that you use the .py suffix in the program name, so be sure to set it when downloading, or at least rename it after the download.

+ +

Right click on it and select Cut. Go to the explorer Window we left open previously, right click on an emtpy space and choose Paste. Tadah! Installation finished.

+ +

Now let's suppose I want to download a video to my Windows Desktop. Piece of cake: go to Start > Run, type cmd and press the enter key. Type the command cd desktop and then type the command youtube-dl.py "", where is a YouTube video URL you can copy from your web browser program address bar, and paste it to the command line interpreter window by right clicking and choosing Paste, for example. Remember commands are always followed by pressing the enter key in the command line interpreter.

+ +

One final tip

+ +

If you are going to store all your videos in a fixed folder, some people find it handy to create a shortcut to cmd that starts with the current working directory set to that folder, so as to avoid typing a cd command each time they launch cmd. To do this, right click on an empty space in your Desktop and choose to create a new shortcut. The program you want to launch is cmd and you can give the shortcut any name you want. After it's created, right click on it, choose Properties and, in the Shortcut tab, which should be the one selected by default, there's an option called Start in:. Put something like %USERPROFILE%\Desktop or %USERPROFILE%\My Documents in it. Some people also prefer to put that shortcut in the quickstart bar to the right of the Start button. Whatever floats your boat.

+ +

Conclusions

+ +

The hardest part is preparing the Windows system to run user command line programs, as it's not initially prepared to do that. Linux, MacOSX and other systems are, in my humble opinion, better prepared, out of the box, for downloading and running your own command line programs easily.

+ +

A remaining question is how to play those videos. You'll need a video player capable of playing FLV videos. I know a couple of them, but you should better ask a Windows expert about it. At least the video files will be in your hard drive, so sooner or later you'll be able to play them.

+ +

Good luck!

+ +