Merge remote-tracking branch 'origin/master'
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 29 Oct 2013 05:48:18 +0000 (06:48 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 29 Oct 2013 05:48:18 +0000 (06:48 +0100)
test/test_download.py
youtube_dl/extractor/mtv.py

index 565afa1b5f9fea031c74f86274695c90410ffcc1..dfb04d010a0814037a1da4aac52ff1f65c2b1ab6 100644 (file)
@@ -26,6 +26,7 @@ import youtube_dl.YoutubeDL
 from youtube_dl.utils import (
     compat_str,
     compat_urllib_error,
+    compat_HTTPError,
     DownloadError,
     ExtractorError,
     UnavailableVideoError,
@@ -105,7 +106,7 @@ def generator(test_case):
                     ydl.download([test_case['url']])
                 except (DownloadError, ExtractorError) as err:
                     # Check if the exception is not a network related one
-                    if not err.exc_info[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError):
+                    if not err.exc_info[0] in (compat_urllib_error.URLError, socket.timeout, UnavailableVideoError) or (err.exc_info[0] == compat_HTTPError and err.exc_info[1].code == 503):
                         raise
 
                     if try_num == RETRIES:
index e520e2bb491f2c55f3867ab214b2b949eca6e684..e96d3952cc79ebe8294302d9795672b7a574590e 100644 (file)
@@ -80,6 +80,8 @@ class MTVIE(InfoExtractor):
         video_id = self._id_from_uri(uri)
         self.report_extraction(video_id)
         mediagen_url = itemdoc.find('%s/%s' % (_media_xml_tag('group'), _media_xml_tag('content'))).attrib['url']
+        # Remove the templates, like &device={device}
+        mediagen_url = re.sub(r'&[^=]*?={.*?}(?=(&|$))', u'', mediagen_url)
         if 'acceptMethods' not in mediagen_url:
             mediagen_url += '&acceptMethods=fms'
         mediagen_page = self._download_webpage(mediagen_url, video_id,