- 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)