diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2015-03-01 12:05:13 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2015-03-01 12:05:13 +0100 |
commit | f7e2ee8fa6a3c5ca9ae8b8d25ae489f502c6277c (patch) | |
tree | da641b3ccffbe5c9257e175661791c66dbc359b9 | |
parent | 66dc9a3701cd97af44cf478e813d4f7eb0947edc (diff) | |
parent | 31bd39256b153391f521169ae449fd8c7c6e51d7 (diff) | |
download | youtube-dl-f7e2ee8fa6a3c5ca9ae8b8d25ae489f502c6277c.tar.xz |
Merge branch 'master' of github.com:rg3/youtube-dl
-rwxr-xr-x | youtube_dl/YoutubeDL.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index d7c6db0ff..15367c4e3 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -4,8 +4,10 @@ from __future__ import absolute_import, unicode_literals import collections +import contextlib import datetime import errno +import fileinput import io import itertools import json @@ -1452,8 +1454,11 @@ class YoutubeDL(object): return self._download_retcode def download_with_info_file(self, info_filename): - with io.open(info_filename, 'r', encoding='utf-8') as f: - info = json.load(f) + with contextlib.closing(fileinput.FileInput( + [info_filename], mode='r', + openhook=fileinput.hook_encoded('utf-8'))) as f: + # FileInput doesn't have a read method, we can't call json.load + info = json.loads('\n'.join(f)) try: self.process_ie_result(info, download=True) except DownloadError: |