Update User-agent string
[youtube-dl] / youtube-dl
index 9bbecf7d4a88ae9d29a88beb60b08103efbe3a38..aa16ff1e4ced11af45527fdf602a85c9a914f37f 100755 (executable)
@@ -19,7 +19,7 @@ import urllib
 import urllib2
 
 std_headers = {
-       'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8',
+       'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2',
        'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
        'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
        'Accept-Language': 'en-us,en;q=0.5',
@@ -227,7 +227,7 @@ class FileDownloader(object):
        
        def to_stderr(self, message):
                """Print message to stderr."""
-               print >>sys.stderr, message
+               print >>sys.stderr, message.encode(locale.getpreferredencoding())
        
        def fixed_template(self):
                """Checks if the output template is fixed."""
@@ -308,7 +308,7 @@ class FileDownloader(object):
                except (ValueError, KeyError), err:
                        self.trouble('ERROR: invalid output template or system charset: %s' % str(err))
                if self.params['nooverwrites'] and os.path.exists(filename):
-                       self.to_stderr('WARNING: file exists: %s; skipping' % filename)
+                       self.to_stderr(u'WARNING: file exists: %s; skipping' % filename)
                        return
 
                try:
@@ -510,7 +510,7 @@ class YoutubeIE(InfoExtractor):
        _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'
        _NETRC_MACHINE = 'youtube'
-       _available_formats = ['22', '35', '18', '17', '13'] # listed in order of priority for -b flag
+       _available_formats = ['22', '35', '18', '5', '17', '13'] # listed in order of priority for -b flag
        _video_extensions = {
                '13': '3gp',
                '17': 'mp4',
@@ -821,19 +821,21 @@ 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=([^&]+)', webpage)
                if mobj is None:
                        self._downloader.trouble(u'ERROR: unable to extract media URL')
                        return
                mediaURL = urllib.unquote(mobj.group(1))
 
-               mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage)
-               if mobj is None:
-                       self._downloader.trouble(u'ERROR: unable to extract gdaKey')
-                       return
-               gdaKey = mobj.group(1)
+               #mobj = re.search(r'(?m)&gdaKey=(.*?)&', webpage)
+               #if mobj is None:
+               #       self._downloader.trouble(u'ERROR: unable to extract gdaKey')
+               #       return
+               #gdaKey = mobj.group(1)
+               #
+               #video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
 
-               video_url = '%s?__gda__=%s' % (mediaURL, gdaKey)
+               video_url = mediaURL
 
                mobj = re.search(r'(?im)<title>(.*) - Video</title>', webpage)
                if mobj is None:
@@ -1071,7 +1073,7 @@ if __name__ == '__main__':
                # Parse command line
                parser = optparse.OptionParser(
                        usage='Usage: %prog [options] url...',
-                       version='INTERNAL',
+                       version='2009.06.29',
                        conflict_handler='resolve',
                )