A feature-rich command-line audio/video downloader
Fix --extract-audio on Python 3
Philipp Hagemeister5910e210f488
diff --git a/youtube_dl/PostProcessor.py b/youtube_dl/PostProcessor.pyindex af00f80eed..cc7789e3bf 100644--- a/youtube_dl/PostProcessor.py+++ b/youtube_dl/PostProcessor.py@@ -86,14 +86,14 @@ class FFmpegExtractAudioPP(PostProcessor):if not self._exes['ffprobe'] and not self._exes['avprobe']: return Nonetry:cmd = [self._exes['avprobe'] or self._exes['ffprobe'], '-show_streams', '--', encodeFilename(path)]- handle = subprocess.Popen(cmd, stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)+ handle = subprocess.Popen(cmd, stderr=compat_subprocess_get_DEVNULL(), stdout=subprocess.PIPE)output = handle.communicate()[0]if handle.wait() != 0:return Noneexcept (IOError, OSError):return Noneaudio_codec = None- for line in output.split('\n'):+ for line in output.decode('ascii', 'ignore').split('\n'):if line.startswith('codec_name='):audio_codec = line.split('=')[1].strip()elif line.strip() == 'codec_type=audio' and audio_codec is not None:diff --git a/youtube_dl/utils.py b/youtube_dl/utils.pyindex 44f939053a..25b67db066 100644--- a/youtube_dl/utils.py+++ b/youtube_dl/utils.py@@ -51,6 +51,12 @@ try:except ImportError: # Python 2import httplib as compat_http_client+try:+ from subprocess import DEVNULL+ compat_subprocess_get_DEVNULL = lambda: DEVNULL+except ImportError:+ compat_subprocess_get_DEVNULL = lambda: open(os.path.devnull, 'w')+try:from urllib.parse import parse_qs as compat_parse_qsexcept ImportError: # Python 2