aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/youtube.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-10-02 08:23:53 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-10-02 08:23:53 +0200
commit4f8bf17f23e2366205d8670fc9af2568063f7e89 (patch)
tree0cd76f061d93cdca164bb9b102a6a039f37c594f /youtube_dl/extractor/youtube.py
parentca40186c75d93250f9115328838703b021f21c8a (diff)
parentfa556755930db77c62016a468d870e76608db012 (diff)
Merge remote-tracking branch 'holomorph/master'
Diffstat (limited to 'youtube_dl/extractor/youtube.py')
-rw-r--r--youtube_dl/extractor/youtube.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 4389924c5..f3d279210 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -421,8 +421,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
# Read from filesystem cache
func_id = '%s_%s_%d' % (player_type, player_id, slen)
assert os.path.basename(func_id) == func_id
- cache_dir = self._downloader.params.get('cachedir',
- u'~/.youtube-dl/cache')
+ xdg_cache_home = os.environ.get('XDG_CACHE_HOME')
+ if xdg_cache_home:
+ userCacheDir = os.path.join(xdg_cache_home, 'youtube-dl')
+ else:
+ userCacheDir = os.path.join(os.path.expanduser('~'), '.cache', 'youtube-dl')
+ cache_dir = self._downloader.params.get('cachedir', userCacheDir)
cache_enabled = cache_dir is not None
if cache_enabled: