A feature-rich command-line audio/video downloader
Use io.BytesIO instead of StringIO
Philipp Hagemeister03f9daab3460
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.pyindex 28731b895a..3ddaddd7f2 100644--- a/youtube_dl/InfoExtractors.py+++ b/youtube_dl/InfoExtractors.py@@ -2,7 +2,6 @@# -*- coding: utf-8 -*-import datetime-import HTMLParserimport httplibimport netrcimport os@@ -15,11 +14,6 @@ import randomimport mathfrom urlparse import parse_qs-try:- import cStringIO as StringIO-except ImportError:- import StringIO-from utils import *diff --git a/youtube_dl/utils.py b/youtube_dl/utils.pyindex c4917012bb..ebff2e8f2a 100644--- a/youtube_dl/utils.py+++ b/youtube_dl/utils.py@@ -2,6 +2,7 @@# -*- coding: utf-8 -*-import gzip+import ioimport localeimport osimport re@@ -10,11 +11,6 @@ import zlibimport email.utilsimport json-try:- import cStringIO as StringIO-except ImportError:- import StringIO-try:import urllib.request as compat_urllib_requestexcept ImportError: # Python 2@@ -400,12 +396,12 @@ class YoutubeDLHandler(compat_urllib_request.HTTPHandler):old_resp = resp# gzipif resp.headers.get('Content-encoding', '') == 'gzip':- gz = gzip.GzipFile(fileobj=StringIO.StringIO(resp.read()), mode='r')+ gz = gzip.GzipFile(fileobj=io.BytesIO(resp.read()), mode='r')resp = self.addinfourl_wrapper(gz, old_resp.headers, old_resp.url, old_resp.code)resp.msg = old_resp.msg# deflateif resp.headers.get('Content-encoding', '') == 'deflate':- gz = StringIO.StringIO(self.deflate(resp.read()))+ gz = io.BytesIO(self.deflate(resp.read()))resp = self.addinfourl_wrapper(gz, old_resp.headers, old_resp.url, old_resp.code)resp.msg = old_resp.msgreturn resp