X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube-dl;h=9fe58a3547e37858ecc3c02482b7bf2c4654be79;hb=8d2c83eda50f07447ea93c73e17b9c5330106fbc;hp=0ec7adb1da10cebc467941a19d6ae1bddea6a240;hpb=2851b2ca18be6a34300075a94003b14865b53611;p=youtube-dl.git diff --git a/youtube-dl b/youtube-dl index 0ec7adb1d..9fe58a354 100755 --- a/youtube-dl +++ b/youtube-dl @@ -190,7 +190,7 @@ class FileDownloader(object): def to_stdout(self, message, skip_eol=False): """Print message to stdout if not in quiet mode.""" if not self.params.get('quiet', False): - print u'%s%s' % (message, [u'\n', u''][skip_eol]), + print (u'%s%s' % (message, [u'\n', u''][skip_eol])).encode(locale.getpreferredencoding()), sys.stdout.flush() def to_stderr(self, message): @@ -244,9 +244,9 @@ class FileDownloader(object): """Process a single dictionary returned by an InfoExtractor.""" # Forced printings if self.params.get('forcetitle', False): - print info_dict['title'] + print info_dict['title'].encode(locale.getpreferredencoding()) if self.params.get('forceurl', False): - print info_dict['url'] + print info_dict['url'].encode(locale.getpreferredencoding()) # Do nothing else if in simulate mode if self.params.get('simulate', False): @@ -561,7 +561,8 @@ class YoutubeIE(InfoExtractor): # Extension video_extension = { - '17': '3gp', + '13': '3gp', + '17': 'mp4', '18': 'mp4', '22': 'mp4', }.get(format_param, 'flv') @@ -624,6 +625,7 @@ class MetacafeIE(InfoExtractor): _VALID_URL = r'(?:http://)?(?:www\.)?metacafe\.com/watch/([^/]+)/([^/]+)/.*' _DISCLAIMER = 'http://www.metacafe.com/family_filter/' + _FILTER_POST = 'http://www.metacafe.com/f/index.php?inputType=filter&controllerGroup=user' _youtube_ie = None def __init__(self, youtube_ie, downloader=None): @@ -665,7 +667,7 @@ class MetacafeIE(InfoExtractor): 'filters': '0', 'submit': "Continue - I'm over 18", } - request = urllib2.Request('http://www.metacafe.com/', urllib.urlencode(disclaimer_form), std_headers) + request = urllib2.Request(self._FILTER_POST, urllib.urlencode(disclaimer_form), std_headers) try: self.report_age_confirmation() disclaimer = urllib2.urlopen(request).read() @@ -702,13 +704,13 @@ class MetacafeIE(InfoExtractor): # Extract URL, uploader and title from webpage self.report_extraction(video_id) - mobj = re.search(r'(?m)"mediaURL":"(http.*?\.flv)"', webpage) + mobj = re.search(r'(?m)&mediaURL=(http.*?\.flv)', webpage) if mobj is None: self._downloader.trouble(u'ERROR: unable to extract media URL') return - mediaURL = mobj.group(1).replace('\\', '') + mediaURL = urllib.unquote(mobj.group(1)) - mobj = re.search(r'(?m)"gdaKey":"(.*?)"', webpage) + mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage) if mobj is None: self._downloader.trouble(u'ERROR: unable to extract gdaKey') return @@ -722,11 +724,11 @@ class MetacafeIE(InfoExtractor): return video_title = mobj.group(1).decode('utf-8') - mobj = re.search(r'(?m)