Repository: ytdl-org/youtube-dl

Issue:
youtube-dl fails to download video; no explanation
```
$ youtube-dl --version
2012.02.27
$ youtube-dl -v 'http://www.youtube.com/watch?v=7YeonrZUMHo'
[debug] Proxy map: {}
[youtube] Setting language
[youtube] 7YeonrZUMHo: Downloading video webpage
[youtube] 7YeonrZUMHo: Downloading video info webpage
[youtube] 7YeonrZUMHo: Extracting video information

ERROR: unable to download video
```

I can watch the video just fine in my browser, even if I'm not logged in to Youtube.  youtube-dl downloads descriptions and .info.json files just fine.



Discussion:
It's a 403 error. Most, but not all Youtube URLs I've tried today give this error now.

```
$ youtube-dl -g 'http://www.youtube.com/watch?v=7YeonrZUMHo' | xargs curl -I
HTTP/1.1 403 Forbidden
Last-Modified: Wed, 02 May 2007 10:26:10 GMT
Content-Type: text/plain
Connection: close
X-Content-Type-Options: nosniff
Date: Thu, 27 Sep 2012 03:46:34 GMT
Server: gvs 1.0
```

Confirmed here as well.. Python 2.6.6, generic public videos won't download. Oh, and these things always occur when you've been searching for a solution all day, you finally find one, setup the server, update python, update the paths, and you bash your head for hours.. then finally since it's so recent Google hasn't picked this thread up, and you stumble here, somewhat relieved, somewhat disoriented by a full day gone by and no way to get that gratification that you 'got something working'. :) 

It seems that youtube now has a 'signature' request param. Modifying or removing that results in a 403. No idea where it comes from yet.

I just experienced this too. Something Bad has changed at Google, I think. Not good.

I was having the problem with a release from 2/12/2012 on Python 2.5, then tried with the latest youtbe-dl git commit  on Python 2.7.3, same error.

Confirmed too. Debian Testing.

> youtube-dl --version
> 2012.02.27
> 
> python --version
> Python 2.7.3rc2

The permanent fix for ALL content grabbers is a FireFox command line API, where after you navigate to a page you can pick from the cache what you'd like to keep, and download anything through the browser as a background service without the UI. - YouTube can always break a script, but the browser it has to respect.

That is a solution for one video at a time but youtube-dl provide the means to download all the videos of a user on youtube in one single command which is what I need.

The 'signature' param is generated on server like everything else and is present in "url_encoded_fmt_stream_map" as "sig", among other things. Just get the url from "url_encoded_fmt_stream_map", change '&sig=' to '&signature=' and it's ready to use, unless I'm missing something.


Resolving patch:
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -402,7 +402,7 @@ def _real_extract(self, url):
 			url_data_strs = video_info['url_encoded_fmt_stream_map'][0].split(',')
 			url_data = [parse_qs(uds) for uds in url_data_strs]
 			url_data = filter(lambda ud: 'itag' in ud and 'url' in ud, url_data)
-			url_map = dict((ud['itag'][0], ud['url'][0]) for ud in url_data)
+			url_map = dict((ud['itag'][0], ud['url'][0] + '&signature=' + ud['sig'][0]) for ud in url_data)
 
 			format_limit = self._downloader.params.get('format_limit', None)
 			available_formats = self._available_formats_prefer_free if self._downloader.params.get('prefer_free_formats', False) else self._available_formats


Test patch: