[youtube-dl] Update to latest release

Till Maas till at fedoraproject.org
Thu Oct 7 19:42:13 UTC 2010


commit 86328827ba135faa6effe01c5a6fec7609b75294
Author: Till Maas <opensource at till.name>
Date:   Thu Oct 7 21:42:04 2010 +0200

    Update to latest release

 Home            |  219 ++++++++++++++++++++++++++++++++-----------------------
 youtube-dl      |   82 ++++++++++++---------
 youtube-dl.spec |    5 +-
 3 files changed, 180 insertions(+), 126 deletions(-)
---
diff --git a/Home b/Home
index e7bce9a..af1294a 100644
--- a/Home
+++ b/Home
@@ -1,25 +1,39 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
-	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
 	<title>
-	rg3 / youtube-dl / wiki / Home &mdash; bitbucket.org
+	rg3 / youtube-dl / wiki / Home &mdash; Bitbucket
 </title>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-	<meta name="description" content="Mercurial hosting - we're here to serve." />
-	<meta name="keywords" content="mercurial,hg,hosting,bitbucket,rg3,youtube-dl,is,a,small,command-line,program,for,downloading,videos,from,YouTube.com.,wiki" />
-	<link rel="stylesheet" type="text/css" href="http://bitbucket-assets.s3.amazonaws.com/css/layout.css" />
-    <link rel="stylesheet" type="text/css" href="http://bitbucket-assets.s3.amazonaws.com/css/screen.css" />
-	<link rel="stylesheet" type="text/css" href="http://bitbucket-assets.s3.amazonaws.com/css/print.css" media="print" />
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+	<meta name="description" content="" />
+	<meta name="keywords" content="rg3,youtube-dl,is,a,small,command-line,program,for,downloading,videos,from,YouTube.com.,wiki" />
+
+	<link rel="stylesheet" type="text/css" href="http://bitbucket-assets.s3.amazonaws.com/css/layout.css?10293858" />
+    <link rel="stylesheet" type="text/css" href="http://bitbucket-assets.s3.amazonaws.com/css/screen.css?10293858" />
+    <link rel="stylesheet" href="http://bitbucket-assets.s3.amazonaws.com/css/reset.css?10293858" type="text/css" />
+	<link rel="stylesheet" href="http://bitbucket-assets.s3.amazonaws.com/css/main.css?10293858" type="text/css" />
+	<link rel="stylesheet" type="text/css" href="http://bitbucket-assets.s3.amazonaws.com/css/print.css?10293858" media="print" />
 	<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Bitbucket" />
 	<link rel="icon" href="http://bitbucket-assets.s3.amazonaws.com/img/logo_new.png" type="image/png"/>
+    
 	<script type="text/javascript">var MEDIA_URL = "http://bitbucket-assets.s3.amazonaws.com/"</script>
 	<script type="text/javascript" src="http://bitbucket-assets.s3.amazonaws.com/js/lib/bundle.020510May.js"></script>
 	
 	<script type="text/javascript">
 		$(document).ready(function() {
-			Dropdown.init();
-			$(".tooltip").tipsy({gravity:'s'});
+			$('.dropdown').hover(
+                    function(){
+                      $(this).addClass('open');
+					  $(this).next('ul.dropdown-list').css('display', 'block');
+                    },
+                    function(){
+                        $('.dropdown').removeClass('open');
+					  	$(this).next('ul.dropdown-list').css('display', 'none');
+
+                    }
+            );
+            $.ajaxSetup ({ cache: false });
 		});
 	</script>
 	<noscript>
@@ -29,29 +43,6 @@
 			}
 		</style>
 	</noscript>
-
-	<!--[if lt IE 7]>
-	<style type="text/css">
-	body {
-		behavior: url(http://bitbucket-assets.s3.amazonaws.com/css/csshover.htc);
-	}
-	
-	#issues-issue pre {
-		white-space: normal !important;
-	}
-	
-	.changeset-description {
-		white-space: normal !important;
-	}
-	</style>
-	<script type="text/javascript"> 
-		$(document).ready(function(){ 
-			$('#header-wrapper').pngFix();
-			$('#sourcelist').pngFix();
-			$('.promo-signup-screenshot').pngFix();
-		}); 
-	</script>
-	<![endif]-->
 	
 	<link rel="stylesheet" href="http://bitbucket-assets.s3.amazonaws.com/css/highlight/default.css" type="text/css" />
 	<script type="text/javascript">
@@ -64,34 +55,61 @@
 	
 	<link href="/rg3/youtube-dl/rss" rel="alternate nofollow" type="application/rss+xml" title="RSS Feed for youtube-dl" />
 
+    <style type="text/css">
+      /* body { background: #fff url('/m/img/layout/bg_header_new.png') repeat-x left 24px !important; } */
+    </style>
 </head>
+
 <body class="">
-	<div id="main-wrapper">
-		<div id="header-wrapper">
-			<div id="header">
-				<a href="/"><img src="http://bitbucket-assets.s3.amazonaws.com/img/logo_myriad.png" alt="Bitbucket" id="header-wrapper-logo" /></a>
-				
-					<div id="header-nav">
-						<ul class="right">
-							<li><a href="/">Home</a></li>
-							<li><a href="/plans"><b>Plans &amp; Signup</b></a></li>
-							<li><a href="/repo/all">Repositories</a></li>
-							<li><a href="/news">News</a></li>
-							<li><a href="/help">Help</a></li>
-							<li><a href="/account/signin/">Sign in</a></li>
-						</ul>
-					</div>
-				
-			</div>
+
+
+<div id="header-wrap" class="clearfix">
+	<div id="header" class="clearfix">
+		<ul id="global-nav">
+			<li id="global-nav-home"><a href="http://www.atlassian.com">Atlassian Home</a></li>
+			<li id="global-nav-documentation"><a href="http://confluence.atlassian.com/display/BITBUCKET">Documentation</a></li>
+			<li id="global-nav-support"><a href="/support">Support</a></li>
+			<li id="global-nav-blogs"><a href="http://blog.bitbucket.org">Blog</a></li>
+			<li id="global-nav-forums"><a href="http://groups.google.com/group/bitbucket-users">Forums</a></li>
+		</ul>
+		<div id="logo">
+			<a href="/">Bitbucket by Atlassian</a>
+		</div>
+
+		<div id="main-nav" class="clearfix">
+		
+			<ul class="clearfix">
+				<li><a href="/plans">Pricing &amp; Signup</a></li>
+				<li><a href="/repo/all">Explore Bitbucket</a></li>
+				<li><a href="/account/signin/">Log in</a></li>
+				<li class="search-box">
+					<form action="/repo/all/" method="get">
+						<input id="search" type="text" name="name" />
+					</form>
+				</li>
+			</ul>
+		
 		</div>
+	</div>
+	
+
+</div>
+
+
+        
+            
+            
+                
+
+        
 		<div id="content-wrapper">
 			
-			
-			
 
-			
-			
-			
+<div id="wrapper">
+
+    <div id="content-wrapper">
+	<div id="content">
+	
 	
 	
 
@@ -105,7 +123,7 @@
 		date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
 		var cookieoptions = { path: '/', expires: date };
 		
-		window._shard = 'bfg02-gunicorn (ID 7)';
+		window._shard = 'bitbucket01 (ID 8)';
 		
 		$(document).ready(function(){
 			$('#toggle-repo-content').click(function(){
@@ -177,7 +195,7 @@
 		
 			
 				<li class="ui-tabs-nav-issues">
-					<a href="/rg3/youtube-dl/issues?status=new&amp;status=open"><span>Issues (15) &raquo;</span></a>
+					<a href="/rg3/youtube-dl/issues?status=new&amp;status=open"><span>Issues (17) &raquo;</span></a>
 					<ul>
 						<li><a href="/rg3/youtube-dl/issues?status=new">New issues</a></li>
 						<li><a href="/rg3/youtube-dl/issues?status=new&amp;status=open">Open issues</a></li>
@@ -196,11 +214,11 @@
 		
 		
 		<li class="tabs-right tabs-far-right">
-			<a href="/rg3/youtube-dl/descendants"><span>Forks/Queues (12)</span></a>
+			<a href="/rg3/youtube-dl/descendants"><span>Forks/Queues (17)</span></a>
 		</li>
 		
 		<li class="tabs-right">
-			<a href="/rg3/youtube-dl/zealots"><span>Followers (85)</span></a>
+			<a href="/rg3/youtube-dl/zealots"><span>Followers (97)</span></a>
 		</li>
 	</ul>
 </div>
@@ -235,9 +253,9 @@
 					<ul>
 						
 						
-							<li><a rel="nofollow" href="/rg3/youtube-dl/get/2df34df5ff7d.zip" class="zip">zip</a></li>
-							<li><a rel="nofollow" href="/rg3/youtube-dl/get/2df34df5ff7d.gz" class="compressed">gz</a></li>
-							<li><a rel="nofollow" href="/rg3/youtube-dl/get/2df34df5ff7d.bz2" class="compressed">bz2</a></li>
+							<li><a rel="nofollow" href="/rg3/youtube-dl/get/190d2d0fd729.zip" class="zip">zip</a></li>
+							<li><a rel="nofollow" href="/rg3/youtube-dl/get/190d2d0fd729.gz" class="compressed">gz</a></li>
+							<li><a rel="nofollow" href="/rg3/youtube-dl/get/190d2d0fd729.bz2" class="compressed">bz2</a></li>
 						
 						
 					</ul>
@@ -253,7 +271,7 @@
 					
 					<ul>
 					
-						<li><a href="/rg3/youtube-dl/src/2df34df5ff7d">default</a></li>
+						<li><a href="/rg3/youtube-dl/src/190d2d0fd729">default</a></li>
 					
 					</ul>
 					
@@ -263,7 +281,7 @@
 					
 					<ul>
 					
-						<li><a href="/rg3/youtube-dl/src/2df34df5ff7d">tip</a></li>
+						<li><a href="/rg3/youtube-dl/src/190d2d0fd729">tip</a></li>
 					
 						<li><a href="/rg3/youtube-dl/src/f8e09aa30813">2010.08.04</a></li>
 					
@@ -348,9 +366,9 @@
 					<ul>
 						
 						
-							<li><a rel="nofollow" href="/rg3/youtube-dl/get/2df34df5ff7d.zip" class="zip">zip</a></li>
-							<li><a rel="nofollow" href="/rg3/youtube-dl/get/2df34df5ff7d.gz" class="compressed">gz</a></li>
-							<li><a rel="nofollow" href="/rg3/youtube-dl/get/2df34df5ff7d.bz2" class="compressed">bz2</a></li>
+							<li><a rel="nofollow" href="/rg3/youtube-dl/get/190d2d0fd729.zip" class="zip">zip</a></li>
+							<li><a rel="nofollow" href="/rg3/youtube-dl/get/190d2d0fd729.gz" class="compressed">gz</a></li>
+							<li><a rel="nofollow" href="/rg3/youtube-dl/get/190d2d0fd729.bz2" class="compressed">bz2</a></li>
 						
 						
 					</ul>
@@ -371,7 +389,7 @@
 		
 		<p class="repo-desc-description">youtube-dl is a small command-line program for downloading videos from <a href="http://YouTube.com" rel="nofollow">YouTube.com</a>.</p>
 		
-		<div id="repo-desc-cloneinfo">Clone this repository (size: 313.2 KB): <a href="http://bitbucket.org/rg3/youtube-dl" onclick="$('#clone-url-ssh').hide();$('#clone-url-https').toggle();return(false);"><small>HTTPS</small></a> / <a href="ssh://hg@bitbucket.org/rg3/youtube-dl" onclick="$('#clone-url-https').hide();$('#clone-url-ssh').toggle();return(false);"><small>SSH</small></a><br/>
+		<div id="repo-desc-cloneinfo">Clone this repository (size: 341.1 KB): <a href="http://bitbucket.org/rg3/youtube-dl" onclick="$('#clone-url-ssh').hide();$('#clone-url-https').toggle();return(false);"><small>HTTPS</small></a> / <a href="ssh://hg@bitbucket.org/rg3/youtube-dl" onclick="$('#clone-url-https').hide();$('#clone-url-ssh').toggle();return(false);"><small>SSH</small></a><br/>
 		<pre id="clone-url-https">$ hg clone <a href="http://bitbucket.org/rg3/youtube-dl">http://bitbucket.org/rg3/youtube-dl</a></pre>
 		
 		<pre id="clone-url-ssh" style="display:none;">$ hg clone <a href="ssh://hg@bitbucket.org/rg3/youtube-dl">ssh://hg@bitbucket.org/rg3/youtube-dl</a></pre></div>
@@ -384,7 +402,7 @@
 	</div>
 
 
-			
+
 			
 
 	
@@ -413,7 +431,7 @@
 <h1 id="youtube-dl-download-videos-from-youtubecom">youtube-dl: Download videos from YouTube.com</h1>
 <p>(and more...)</p>
 <h2 id="what-is-it">What is it?</h2>
-<p><em>youtube-dl</em> is a small command-line program to download videos from YouTube.com and a few more sites. It requires the <a href="http://www.python.org/">Python interpreter</a>, 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 <strong>2010.08.04</strong>. It's released to the public domain, which means you can modify it, redistribute it or use it however you like.</p>
+<p><em>youtube-dl</em> is a small command-line program to download videos from YouTube.com and a few more sites. It requires the <a href="http://www.python.org/">Python interpreter</a>, 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 <strong>2010.10.03</strong>. It's released to the public domain, which means you can modify it, redistribute it or use it however you like.</p>
 <p>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. 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. My contact information is at <a href="http://rg03.wordpress.com/contact-me/">rg03.wordpress.com</a>.</p>
 <p>Thanks for all the feedback received so far. I'm glad people find my program useful.</p>
 <h2 id="usage-instructions">Usage instructions</h2>
@@ -425,10 +443,10 @@
 <p>The program is usually invoked as <em>youtube-dl</em> followed by options and the video URLs. Listing all the options here would make this text too long, so you can run <em>youtube-dl --help</em> 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, and either -f or -b to download a high quality version of the video. 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.</p>
 <h2 id="download-it">Download it</h2>
 <p>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 <em>Save Target As</em> or <em>Save Link As</em>, depending on the web browser you are using.</p>
-<h3 id="httpbitbucketorgrg3youtube-dlraw20100804youtube-dl20100804"><a href="http://bitbucket.org/rg3/youtube-dl/raw/2010.08.04/youtube-dl">2010.08.04</a></h3>
-<ul><li><strong>MD5</strong>: 8b1b8b922b758aae28f6c158e9a1baba
-</li><li><strong>SHA1</strong>: 1497bbaecc3a9b0f343021ab9a1d940315a1003e
-</li><li><strong>SHA256</strong>: 55044a3232a119b82bc8b8b521fba54059b26ec09577606e4a12ce7903732a56
+<h3 id="httpbitbucketorgrg3youtube-dlraw20101003youtube-dl20101003"><a href="http://bitbucket.org/rg3/youtube-dl/raw/2010.10.03/youtube-dl">2010.10.03</a></h3>
+<ul><li><strong>MD5</strong>: c552c00881845689900b67525ac6f72b
+</li><li><strong>SHA1</strong>: 436006432018fca75298e63742bb2c13feb42f98
+</li><li><strong>SHA256</strong>: eb6a5deb494e8949918ca5a674d961439963fadd822df67dfa49ce47fa326d75
 </li></ul>
 <h2 id="faq">FAQ</h2>
 <p>The <a href="/rg3/youtube-dl/wiki/Frequently_Asked_Questions">Frequently Asked Questions</a> 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.</p>
@@ -474,22 +492,41 @@
 	</div>
 
 
-			<div class="cb"></div>
-		</div>
-		<div class="cb footer-placeholder"></div>
 	</div>
-	<div id="footer-wrapper">
-		<div id="footer">
-			<a href="/site/terms/">TOS</a> | <a href="/site/privacy/">Privacy Policy</a> | <a href="http://blog.bitbucket.org/">Blog</a> | <a href="http://bitbucket.org/jespern/bitbucket/issues/new/">Report Bug</a> | <a href="http://groups.google.com/group/bitbucket-users">Discuss</a> | <a href="http://avantlumiere.com/">&copy; 2008-2010</a>
-			| We run <small><b>
-				<a href="http://www.djangoproject.com/">Django 1.2.1</a> / 
-				<a href="http://bitbucket.org/jespern/django-piston/">Piston 0.2.3rc1</a> / 
-				<a href="http://www.selenic.com/mercurial/">Hg 1.3.1</a> / 
-				<a href="http://www.python.org">Python 2.7.0</a> /
-				r3101| bfg02
-			</b></small>
-		</div>
+
+
+	<div id="footer" class="clearfix">
+		<ul class="footer-nav">
+			<li>Copyright &copy; 2010 <a href="http://atlassian.com">Atlassian</a><span class="pipe">|</span></li>
+			<li><a href="http://www.atlassian.com/hosted/terms.jsp">Terms of Service</a><span class="pipe">|</span></li>
+			<li><a href="http://www.atlassian.com/about/privacy.jsp">Privacy</a></li>
+		</ul>
+		<ul class="social-nav">
+			<li class="blog"><a href="http://blog.bitbucket.org">Bitbucket Blog</a></li>
+			<li class="twitter"><a href="http://www.twitter.com/bitbucket">Twitter</a></li>
+		</ul>
 	</div>
+    <div id="footer2" class="clearfix">
+        We run 
+            <a href="http://www.djangoproject.com/">Django 1.2.3</a> / 
+            <a href="http://bitbucket.org/jespern/django-piston/">Piston 0.2.3rc1</a> / 
+            <a href="http://www.selenic.com/mercurial/">Hg 1.6</a> / 
+            <a href="http://www.python.org">Python 2.7.0</a> /
+            r3577 | bitbucket01
+        
+    </div>
+
+</div>
+</div>
+
+
+
+
+
+
+
+
+<!-- <script type="text/javascript"> Cufon.now(); </script> -->
 	
     	<script type="text/javascript">
     	  var _gaq = _gaq || [];
@@ -499,7 +536,7 @@
     	  _gaq.push(['atl._setAccount', 'UA-6032469-33'], ['atl._trackPageview']);
     	  (function() {
     	    var ga = document.createElement('script');
-    	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
+    	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
     	        'http://www') + '.google-analytics.com/ga.js';
     	    ga.setAttribute('async', 'true');
     	    document.documentElement.firstChild.appendChild(ga);
diff --git a/youtube-dl b/youtube-dl
index d546949..51344f2 100644
--- a/youtube-dl
+++ b/youtube-dl
@@ -194,7 +194,7 @@ class FileDownloader(object):
 	ignoreerrors:	Do not stop on download errors.
 	ratelimit:	Download speed limit, in bytes/sec.
 	nooverwrites:	Prevent overwriting files.
-	retries:	Number of times to retry for HTTP error 503
+	retries:	Number of times to retry for HTTP error 5xx
 	continuedl:	Try to continue downloads if possible.
 	noprogress:	Do not print the progress bar.
 	"""
@@ -353,12 +353,12 @@ class FileDownloader(object):
 				(percent_str, data_len_str, speed_str, eta_str), skip_eol=True)
 
 	def report_resuming_byte(self, resume_len):
-		"""Report attemtp to resume at given byte."""
+		"""Report attempt to resume at given byte."""
 		self.to_stdout(u'[download] Resuming download at byte %s' % resume_len)
 	
 	def report_retry(self, count, retries):
-		"""Report retry in case of HTTP error 503"""
-		self.to_stdout(u'[download] Got HTTP error 503. Retrying (attempt %d of %d)...' % (count, retries))
+		"""Report retry in case of HTTP error 5xx"""
+		self.to_stdout(u'[download] Got server HTTP error. Retrying (attempt %d of %d)...' % (count, retries))
 	
 	def report_file_already_downloaded(self, file_name):
 		"""Report file has already been fully downloaded."""
@@ -404,15 +404,16 @@ class FileDownloader(object):
 			template_dict['ord'] = unicode('%05d' % self._num_downloads)
 			filename = self.params['outtmpl'] % template_dict
 		except (ValueError, KeyError), err:
-			self.trouble('ERROR: invalid output template or system charset: %s' % str(err))
+			self.trouble(u'ERROR: invalid system charset or erroneous output template')
+			return
 		if self.params.get('nooverwrites', False) and os.path.exists(filename):
-			self.to_stderr(u'WARNING: file exists: %s; skipping' % filename)
+			self.to_stderr(u'WARNING: file exists and will be skipped')
 			return
 
 		try:
 			self.pmkdir(filename)
 		except (OSError, IOError), err:
-			self.trouble('ERROR: unable to create directories: %s' % str(err))
+			self.trouble(u'ERROR: unable to create directories: %s' % str(err))
 			return
 
 		try:
@@ -420,17 +421,17 @@ class FileDownloader(object):
 		except (OSError, IOError), err:
 			raise UnavailableVideoError
 		except (urllib2.URLError, httplib.HTTPException, socket.error), err:
-			self.trouble('ERROR: unable to download video data: %s' % str(err))
+			self.trouble(u'ERROR: unable to download video data: %s' % str(err))
 			return
 		except (ContentTooShortError, ), err:
-			self.trouble('ERROR: content too short (expected %s bytes and served %s)' % (err.expected, err.downloaded))
+			self.trouble(u'ERROR: content too short (expected %s bytes and served %s)' % (err.expected, err.downloaded))
 			return
 
 		if success:
 			try:
 				self.post_process(filename, info_dict)
 			except (PostProcessingError), err:
-				self.trouble('ERROR: postprocessing: %s' % str(err))
+				self.trouble(u'ERROR: postprocessing: %s' % str(err))
 				return
 
 	def download(self, url_list):
@@ -455,7 +456,7 @@ class FileDownloader(object):
 				break
 
 			if not suitable_found:
-				self.trouble('ERROR: no suitable InfoExtractor: %s' % url)
+				self.trouble(u'ERROR: no suitable InfoExtractor: %s' % url)
 
 		return self._download_retcode
 
@@ -495,7 +496,7 @@ class FileDownloader(object):
 			self.to_stdout(u'\r[rtmpdump] %s bytes' % os.path.getsize(filename))
 			return True
 		else:
-			self.trouble('\nERROR: rtmpdump exited with code %d' % retval)
+			self.trouble(u'\nERROR: rtmpdump exited with code %d' % retval)
 			return False
 
 	def _do_download(self, filename, url, player_url):
@@ -528,7 +529,7 @@ class FileDownloader(object):
 				data = urllib2.urlopen(request)
 				break
 			except (urllib2.HTTPError, ), err:
-				if err.code != 503 and err.code != 416:
+				if (err.code < 500 or err.code >= 600) and err.code != 416:
 					# Unexpected HTTP error
 					raise
 				elif err.code == 416:
@@ -538,7 +539,7 @@ class FileDownloader(object):
 						data = urllib2.urlopen(basic_request)
 						content_length = data.info()['Content-Length']
 					except (urllib2.HTTPError, ), err:
-						if err.code != 503:
+						if err.code < 500 or err.code >= 600:
 							raise
 					else:
 						# Examine the reported length
@@ -588,12 +589,13 @@ class FileDownloader(object):
 					(stream, filename) = sanitize_open(filename, open_mode)
 					self.report_destination(filename)
 				except (OSError, IOError), err:
-					self.trouble('ERROR: unable to open for writing: %s' % str(err))
+					self.trouble(u'ERROR: unable to open for writing: %s' % str(err))
 					return False
 			try:
 				stream.write(data_block)
 			except (IOError, OSError), err:
-				self.trouble('\nERROR: unable to write data: %s' % str(err))
+				self.trouble(u'\nERROR: unable to write data: %s' % str(err))
+				return False
 			block_size = self.best_block_size(after - before, data_block_len)
 
 			# Progress message
@@ -684,7 +686,7 @@ class InfoExtractor(object):
 class YoutubeIE(InfoExtractor):
 	"""Information extractor for youtube.com."""
 
-	_VALID_URL = r'^((?:http://)?(?:youtu\.be/|(?:\w+\.)?youtube\.com/(?:(?:v/)|(?:(?:watch(?:_popup)?(?:\.php)?)?[\?#](?:.+&)?v=))))?([0-9A-Za-z_-]+)(?(1).+)?$'
+	_VALID_URL = r'^((?:http://)?(?:youtu\.be/|(?:\w+\.)?youtube(?:-nocookie)?\.com/(?:(?:v/)|(?:(?:watch(?:_popup)?(?:\.php)?)?(?:\?|#!?)(?:.+&)?v=))))?([0-9A-Za-z_-]+)(?(1).+)?$'
 	_LANG_URL = r'http://www.youtube.com/?hl=en&persist_hl=1&gl=US&persist_gl=1&opt_out_ackd=1'
 	_LOGIN_URL = 'http://www.youtube.com/signup?next=/&gl=US&hl=en'
 	_AGE_URL = 'http://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
@@ -847,7 +849,7 @@ class YoutubeIE(InfoExtractor):
 				return
 		if 'token' not in video_info:
 			if 'reason' in video_info:
-				self._downloader.trouble(u'ERROR: YouTube said: %s' % video_info['reason'][0])
+				self._downloader.trouble(u'ERROR: YouTube said: %s' % video_info['reason'][0].decode('utf-8'))
 			else:
 				self._downloader.trouble(u'ERROR: "token" parameter not in video info for unknown reason')
 			return
@@ -1020,7 +1022,6 @@ class MetacafeIE(InfoExtractor):
 		self._downloader.increment_downloads()
 
 		simple_title = mobj.group(2).decode('utf-8')
-		video_extension = 'flv'
 
 		# Retrieve video webpage to extract further information
 		request = urllib2.Request('http://www.metacafe.com/watch/%s/' % video_id)
@@ -1034,20 +1035,33 @@ class MetacafeIE(InfoExtractor):
 		# Extract URL, uploader and title from webpage
 		self.report_extraction(video_id)
 		mobj = re.search(r'(?m)&mediaURL=([^&]+)', webpage)
-		if mobj is None:
-			self._downloader.trouble(u'ERROR: unable to extract media URL')
-			return
-		mediaURL = urllib.unquote(mobj.group(1))
-
-		# Extract gdaKey if available
-		mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage)
-		if mobj is None:
-			video_url = mediaURL
-			#self._downloader.trouble(u'ERROR: unable to extract gdaKey')
-			#return
+		if mobj is not None:
+			mediaURL = urllib.unquote(mobj.group(1))
+			video_extension = mediaURL[-3:]
+			
+			# Extract gdaKey if available
+			mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage)
+			if mobj is None:
+				video_url = mediaURL
+			else:
+				gdaKey = mobj.group(1)
+				video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
 		else:
-			gdaKey = mobj.group(1)
-			video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
+			mobj = re.search(r' name="flashvars" value="(.*?)"', webpage)
+			if mobj is None:
+				self._downloader.trouble(u'ERROR: unable to extract media URL')
+				return
+			vardict = parse_qs(mobj.group(1))
+			if 'mediaData' not in vardict:
+				self._downloader.trouble(u'ERROR: unable to extract media URL')
+				return
+			mobj = re.search(r'"mediaURL":"(http.*?)","key":"(.*?)"', vardict['mediaData'][0])
+			if mobj is None:
+				self._downloader.trouble(u'ERROR: unable to extract media URL')
+				return
+			mediaURL = mobj.group(1).replace('\\/', '/')
+			video_extension = mediaURL[-3:]
+			video_url = '%s?__gda__=%s' % (mediaURL, mobj.group(2))
 
 		mobj = re.search(r'(?im)<title>(.*) - Video</title>', webpage)
 		if mobj is None:
@@ -1144,7 +1158,7 @@ class DailymotionIE(InfoExtractor):
 		video_title = mobj.group(1).decode('utf-8')
 		video_title = sanitize_title(video_title)
 
-		mobj = re.search(r'(?im)<div class="dmco_html owner">.*?<a class="name" href="/.+?">(.+?)</a></div>', webpage)
+		mobj = re.search(r'(?im)<div class="dmco_html owner">.*?<a class="name" href="/.+?">(.+?)</a>', webpage)
 		if mobj is None:
 			self._downloader.trouble(u'ERROR: unable to extract uploader nickname')
 			return
@@ -2087,7 +2101,7 @@ if __name__ == '__main__':
 		# Parse command line
 		parser = optparse.OptionParser(
 			usage='Usage: %prog [options] url...',
-			version='2010.08.04',
+			version='2010.10.03',
 			conflict_handler='resolve',
 		)
 
diff --git a/youtube-dl.spec b/youtube-dl.spec
index 0e3e705..a93424f 100644
--- a/youtube-dl.spec
+++ b/youtube-dl.spec
@@ -1,5 +1,5 @@
 Name:           youtube-dl
-Version:        2010.08.04
+Version:        2010.10.03
 Release:        1%{?dist}
 Summary:        Small command-line program to download videos from YouTube
 Summary(pl):    Tekstowy program do pobierania filmów z youtube.com
@@ -39,6 +39,9 @@ rm -rf $RPM_BUILD_ROOT
 %doc index.html
 
 %changelog
+* Thu Oct 07 2010 Till Maas <opensource at till.name> - 2010.10.03-1
+- Update to latest release
+
 * Thu Aug 05 2010 Till Maas <opensource at till.name> - 2010.08.04-1
 - Update to latest release
 


More information about the scm-commits mailing list