From da54ed441267ff3a734e73871099cc1bb0b08543 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Mon, 28 Feb 2011 19:37:58 +0100 Subject: [PATCH 1/5] Support youtube.com/e/ URLs (closes #88) --- youtube-dl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube-dl b/youtube-dl index 9a08932b0..d8485952b 100755 --- a/youtube-dl +++ b/youtube-dl @@ -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' From e3f7e05c274113265b1b780cf6e4a5215f08bc1a Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Tue, 15 Mar 2011 20:03:52 +0100 Subject: [PATCH 2/5] Avoid crash reported in issue #86 --- youtube-dl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube-dl b/youtube-dl index d8485952b..cbfbdca9c 100755 --- a/youtube-dl +++ b/youtube-dl @@ -1079,7 +1079,7 @@ class YoutubeIE(InfoExtractor): # Decide which formats to download req_format = self._downloader.params.get('format', None) - if 'fmt_url_map' in video_info: + if 'fmt_url_map' in video_info and len(video_info['fmt_url_map']) >= 1 and ',' in video_info['fmt_url_map'][0]: url_map = dict(tuple(pair.split('|')) for pair in video_info['fmt_url_map'][0].split(',')) format_limit = self._downloader.params.get('format_limit', None) if format_limit is not None and format_limit in self._available_formats: From 2727dbf78d895885016dac52dff7fdc271a77d8f Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Tue, 15 Mar 2011 20:04:20 +0100 Subject: [PATCH 3/5] Split a couple of lines to make the code more readable --- youtube-dl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube-dl b/youtube-dl index cbfbdca9c..b2cd5e87f 100755 --- a/youtube-dl +++ b/youtube-dl @@ -2620,8 +2620,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 +2638,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 From 3efa45c3a25d455f610439c56c50f2c7cfd0337b Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Tue, 15 Mar 2011 20:12:10 +0100 Subject: [PATCH 4/5] Fix upload date regexp (closes #93) --- youtube-dl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube-dl b/youtube-dl index b2cd5e87f..e3bde779c 100755 --- a/youtube-dl +++ b/youtube-dl @@ -1056,7 +1056,7 @@ class YoutubeIE(InfoExtractor): # upload date upload_date = u'NA' - mobj = re.search(r'id="eow-date".*?>(.*?)', video_webpage, re.DOTALL) + mobj = re.search(r'id="eow-date.*?>(.*?)', 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'] From 4b0d9eed458d862ce938849a9dc88a9a56f57dc2 Mon Sep 17 00:00:00 2001 From: Ricardo Garcia Date: Tue, 29 Mar 2011 20:32:07 +0200 Subject: [PATCH 5/5] Bump version number --- LATEST_VERSION | 2 +- youtube-dl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LATEST_VERSION b/LATEST_VERSION index 42b22d923..295c9c4fa 100644 --- a/LATEST_VERSION +++ b/LATEST_VERSION @@ -1 +1 @@ -2011.02.25c +2011.03.29 diff --git a/youtube-dl b/youtube-dl index e3bde779c..3ac27a857 100755 --- a/youtube-dl +++ b/youtube-dl @@ -2723,7 +2723,7 @@ if __name__ == '__main__': # Parse command line parser = optparse.OptionParser( usage='Usage: %prog [options] url...', - version='2011.02.25c', + version='2011.03.29', conflict_handler='resolve', )