mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-02 19:36:45 +00:00
[youtube] Actually pass in cachedir option
This commit is contained in:
parent
0ca96d48c7
commit
f8061589e6
|
@ -618,7 +618,8 @@ def _real_main(argv=None):
|
||||||
'min_filesize': opts.min_filesize,
|
'min_filesize': opts.min_filesize,
|
||||||
'max_filesize': opts.max_filesize,
|
'max_filesize': opts.max_filesize,
|
||||||
'daterange': date,
|
'daterange': date,
|
||||||
'youtube_print_sig_code': opts.youtube_print_sig_code
|
'cachedir': opts.cachedir,
|
||||||
|
'youtube_print_sig_code': opts.youtube_print_sig_code,
|
||||||
})
|
})
|
||||||
|
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
|
|
|
@ -438,7 +438,8 @@ def _extract_signature_function(self, video_id, player_url, slen):
|
||||||
cache_dir = self._downloader.params.get('cachedir',
|
cache_dir = self._downloader.params.get('cachedir',
|
||||||
u'~/.youtube-dl/cache')
|
u'~/.youtube-dl/cache')
|
||||||
|
|
||||||
if cache_dir != u'NONE':
|
cache_enabled = cache_dir != u'NONE'
|
||||||
|
if cache_enabled:
|
||||||
cache_fn = os.path.join(os.path.expanduser(cache_dir),
|
cache_fn = os.path.join(os.path.expanduser(cache_dir),
|
||||||
u'youtube-sigfuncs',
|
u'youtube-sigfuncs',
|
||||||
func_id + '.json')
|
func_id + '.json')
|
||||||
|
@ -465,7 +466,7 @@ def _extract_signature_function(self, video_id, player_url, slen):
|
||||||
else:
|
else:
|
||||||
assert False, 'Invalid player type %r' % player_type
|
assert False, 'Invalid player type %r' % player_type
|
||||||
|
|
||||||
if cache_dir is not False:
|
if cache_enabled:
|
||||||
try:
|
try:
|
||||||
cache_res = res(map(compat_chr, range(slen)))
|
cache_res = res(map(compat_chr, range(slen)))
|
||||||
cache_spec = [ord(c) for c in cache_res]
|
cache_spec = [ord(c) for c in cache_res]
|
||||||
|
@ -515,7 +516,7 @@ def _genslice(start, end, step):
|
||||||
cache_spec = [ord(c) for c in cache_res]
|
cache_spec = [ord(c) for c in cache_res]
|
||||||
expr_code = u' + '.join(gen_sig_code(cache_spec))
|
expr_code = u' + '.join(gen_sig_code(cache_spec))
|
||||||
code = u'if len(s) == %d:\n return %s\n' % (slen, expr_code)
|
code = u'if len(s) == %d:\n return %s\n' % (slen, expr_code)
|
||||||
self.to_screen(u'Extracted signature:\n' + code)
|
self.to_screen(u'Extracted signature function:\n' + code)
|
||||||
|
|
||||||
def _parse_sig_js(self, jscode):
|
def _parse_sig_js(self, jscode):
|
||||||
funcname = self._search_regex(
|
funcname = self._search_regex(
|
||||||
|
|
Loading…
Reference in a new issue