from cgi import parse_qs
std_headers = {
- 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:2.0b10) Gecko/20100101 Firefox/4.0b10',
+ 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:2.0b11) Gecko/20100101 Firefox/4.0b11',
'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',
_AGE_URL = 'http://www.youtube.com/verify_age?next_url=/&gl=US&hl=en'
_NETRC_MACHINE = 'youtube'
# Listed in order of quality
- _available_formats = ['38', '37', '22', '45', '35', '34', '43', '18', '6', '5', '17', '13']
+ _available_formats = ['38', '37', '45', '22', '43', '35', '34', '18', '6', '5', '17', '13']
_video_extensions = {
'13': '3gp',
'17': 'mp4',
@staticmethod
def get_audio_codec(path):
- handle = subprocess.Popen(['ffprobe', '-show_streams', path],
- stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)
- output = handle.communicate()[0]
- if handle.wait() != 0:
+ try:
+ handle = subprocess.Popen(['ffprobe', '-show_streams', path],
+ stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)
+ output = handle.communicate()[0]
+ if handle.wait() != 0:
+ return None
+ except (IOError, OSError):
return None
audio_codec = None
for line in output.split('\n'):
filecodec = self.get_audio_codec(path)
if filecodec is None:
- self._downloader.to_stderr(u'WARNING: no audio codec found in file')
+ self._downloader.to_stderr(u'WARNING: unable to obtain file audio codec with ffprobe')
return None
more_opts = []
status = self.run_ffmpeg(path, new_path, acodec, more_opts)
if not status:
- self._downloader.to_stderr(u'WARNING: error running ffmpeg' % ret)
+ self._downloader.to_stderr(u'WARNING: error running ffmpeg')
return None
try:
# Parse command line
parser = optparse.OptionParser(
usage='Usage: %prog [options] url...',
- version='2011.01.30',
+ version='2011.02.25b',
conflict_handler='resolve',
)