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',
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."""
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:
_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',
# 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:
# Parse command line
parser = optparse.OptionParser(
usage='Usage: %prog [options] url...',
- version='INTERNAL',
+ version='2009.06.29',
conflict_handler='resolve',
)