]> Raphaël G. Git Repositories - youtubedl/commitdiff
Merge commit 'upstream/2011.08.04'
authorRogério Brito <rbrito@ime.usp.br>
Fri, 5 Aug 2011 15:11:12 +0000 (12:11 -0300)
committerRogério Brito <rbrito@ime.usp.br>
Fri, 5 Aug 2011 15:11:12 +0000 (12:11 -0300)
LATEST_VERSION
youtube-dl

index 4851877b424682c5820cb3b1c353eda10d3bf898..8a3bb049af897ce3d1683a460584905d675ed03c 100644 (file)
@@ -1 +1 @@
-2011.02.25b
+2011.08.04
index 072a919707fa3bdfd805f90ab7765ad9bdd8eb34..e8b19c8d0a6a90265a17000522e5a4e455bb1149 100755 (executable)
@@ -38,7 +38,7 @@ except ImportError:
        from cgi import parse_qs
 
 std_headers = {
-       'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:2.0b11) Gecko/20100101 Firefox/4.0b11',
+       'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:5.0.1) Gecko/20100101 Firefox/5.0.1',
        'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Accept-Encoding': 'gzip, deflate',
@@ -858,7 +858,7 @@ class InfoExtractor(object):
 class YoutubeIE(InfoExtractor):
        """Information extractor for youtube.com."""
 
-       _VALID_URL = r'^((?:https?://)?(?:youtu\.be/|(?:\w+\.)?youtube(?:-nocookie)?\.com/)(?:(?:(?:v|embed)/)|(?:(?:watch(?:_popup)?(?:\.php)?)?(?:\?|#!?)(?:.+&)?v=)))?([0-9A-Za-z_-]+)(?(1).+)?$'
+       _VALID_URL = r'^((?:https?://)?(?:youtu\.be/|(?:\w+\.)?youtube(?:-nocookie)?\.com/)(?:(?:(?:v|embed|e)/)|(?:(?: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 = 'https://www.youtube.com/signup?next=/&gl=US&hl=en'
        _AGE_URL = 'http://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
@@ -1056,7 +1056,7 @@ class YoutubeIE(InfoExtractor):
 
                # upload date
                upload_date = u'NA'
-               mobj = re.search(r'id="eow-date".*?>(.*?)</span>', video_webpage, re.DOTALL)
+               mobj = re.search(r'id="eow-date.*?>(.*?)</span>', video_webpage, re.DOTALL)
                if mobj is not None:
                        upload_date = ' '.join(re.sub(r'[/,-]', r' ', mobj.group(1)).split())
                        format_expressions = ['%d %B %Y', '%B %d %Y', '%b %d %Y']
@@ -1079,8 +1079,10 @@ class YoutubeIE(InfoExtractor):
                # Decide which formats to download
                req_format = self._downloader.params.get('format', None)
 
-               if 'fmt_url_map' in video_info:
-                       url_map = dict(tuple(pair.split('|')) for pair in video_info['fmt_url_map'][0].split(','))
+               if 'url_encoded_fmt_stream_map' in video_info and len(video_info['url_encoded_fmt_stream_map']) >= 1:
+                       url_data_strs = video_info['url_encoded_fmt_stream_map'][0].split(',')
+                       url_data = [dict(pairStr.split('=') for pairStr in uds.split('&')) for uds in url_data_strs]
+                       url_map = dict((ud['itag'], urllib.unquote(ud['url'])) for ud in url_data)
                        format_limit = self._downloader.params.get('format_limit', None)
                        if format_limit is not None and format_limit in self._available_formats:
                                format_list = self._available_formats[self._available_formats.index(format_limit):]
@@ -2620,8 +2622,8 @@ class FFmpegExtractAudioPP(PostProcessor):
        @staticmethod
        def get_audio_codec(path):
                try:
-                       handle = subprocess.Popen(['ffprobe', '-show_streams', path],
-                                       stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)
+                       cmd = ['ffprobe', '-show_streams', '--', path]
+                       handle = subprocess.Popen(cmd, stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)
                        output = handle.communicate()[0]
                        if handle.wait() != 0:
                                return None
@@ -2638,8 +2640,8 @@ class FFmpegExtractAudioPP(PostProcessor):
        @staticmethod
        def run_ffmpeg(path, out_path, codec, more_opts):
                try:
-                       ret = subprocess.call(['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + [out_path],
-                                       stdout=file(os.path.devnull, 'w'), stderr=subprocess.STDOUT)
+                       cmd = ['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + ['--', out_path]
+                       ret = subprocess.call(cmd, stdout=file(os.path.devnull, 'w'), stderr=subprocess.STDOUT)
                        return (ret == 0)
                except (IOError, OSError):
                        return False
@@ -2723,7 +2725,7 @@ if __name__ == '__main__':
                # Parse command line
                parser = optparse.OptionParser(
                        usage='Usage: %prog [options] url...',
-                       version='2011.02.25b',
+                       version='2011.08.04',
                        conflict_handler='resolve',
                )