Ytdl: Add patch to support Tor.
parent
491f6f6fbb
commit
a112e1ac13
|
@ -419,7 +419,13 @@
|
|||
(with-eval-after-load 'ytdl
|
||||
(setq ytdl-always-query-default-filename 'yes)
|
||||
(setq ytdl-max-mini-buffer-download-type-entries 0)
|
||||
(setq ytdl-download-extra-args '("-f" "best")))
|
||||
(setq ytdl-download-extra-args '("-f" "best"))
|
||||
(require 'patch-ytdl)
|
||||
(defun ytdl-no-proxy ()
|
||||
(interactive)
|
||||
(let ((ytdl-download-extra-args (cons "--proxy="
|
||||
ytdl-download-extra-args)))
|
||||
(ytdl-download))))
|
||||
|
||||
(with-eval-after-load 'ztree
|
||||
(set-face-foreground 'ztreep-diff-model-add-face "deep sky blue"))
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
(defun ytdl--get-default-filename (url)
|
||||
"Get default filename from web server.
|
||||
|
||||
Query the default-filename of URL using '--get-filename' argument
|
||||
of ytdl."
|
||||
(if (equal ytdl-always-query-default-filename
|
||||
'never)
|
||||
nil
|
||||
(with-temp-buffer
|
||||
(apply #'call-process ytdl-command nil t nil
|
||||
(append ytdl-download-extra-args
|
||||
(list
|
||||
"--get-filename"
|
||||
"--restrict-filenames"
|
||||
"--" url)))
|
||||
(goto-char (point-min))
|
||||
(if (search-forward-regexp "^ERROR" nil t)
|
||||
(progn
|
||||
(beginning-of-line)
|
||||
(error (buffer-substring-no-properties (line-beginning-position)
|
||||
(line-end-position))))
|
||||
(search-forward ".")
|
||||
(replace-regexp-in-string "/\\|_"
|
||||
"-"
|
||||
(buffer-substring-no-properties (line-beginning-position)
|
||||
(1- (point))))))))
|
||||
|
||||
(provide 'patch-ytdl)
|
Loading…
Reference in New Issue