aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-08-21 12:15:51 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-08-21 12:15:51 +0200
commit55c49908d29bbfb3287159be29e9991f1d5f5b2c (patch)
tree79596a881979f9ca01c8af1e95fefceb7483ac7c
parentdb9b0b67b728ae4bb95ac5ed66fdefa467afbf12 (diff)
downloadyoutube-dl-55c49908d29bbfb3287159be29e9991f1d5f5b2c.tar.xz
[youtube] Handle incorrectly written cache files (#3549)
-rw-r--r--youtube_dl/extractor/youtube.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 3c9b0b584..8b520e0f0 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -374,6 +374,13 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
return lambda s: u''.join(s[i] for i in cache_spec)
except IOError:
pass # No cache available
+ except ValueError:
+ try:
+ file_size = os.path.getsize(cache_fn)
+ except (OSError, IOError) as oe:
+ file_size = str(oe)
+ self._downloader.report_warning(
+ u'Cache %s failed (%s)' % (cache_fn, file_size))
if player_type == 'js':
code = self._download_webpage(