aboutsummaryrefslogtreecommitdiff
path: root/emms-info-ytdl.el
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2022-05-10 15:05:54 +1000
committerYuchen Pei <hi@ypei.me>2022-05-10 15:05:54 +1000
commit0b2c3ffddabb798fa64cd349264e2bc06de3077f (patch)
treebfd3954093455f975c44e26623b4bfa195d10ba1 /emms-info-ytdl.el
parent8b89b43897e8ed5080b8a18b931766e09557fa63 (diff)
added torsocks supportHEADmaster
Diffstat (limited to 'emms-info-ytdl.el')
-rw-r--r--emms-info-ytdl.el19
1 files changed, 14 insertions, 5 deletions
diff --git a/emms-info-ytdl.el b/emms-info-ytdl.el
index 9136860..88fd7d0 100644
--- a/emms-info-ytdl.el
+++ b/emms-info-ytdl.el
@@ -1,6 +1,6 @@
;;; emms-info-ytdl.el --- info-method for EMMS using ytdl -*- lexical-binding: t; -*-
-;; Copyright (C) 2020 Free Software Foundation, Inc.
+;; Copyright (C) 2022 Free Software Foundation, Inc.
;; Author: Yuchen Pei (ycp@gnu.org)
;; Keywords: multimedia
@@ -48,13 +48,18 @@
"Regexp to use ytdl to get info.")
(defvar emms-info-ytdl-exclude-regexp
- "\\(\\.\\w+$\\|/playlist\\|/channel\\)"
+ ;; "\\(\\.\\w+$\\|/playlist\\|/channel\\)"
+ "\\(/playlist\\|/channel\\)"
"Regexp not to use ytdl to get info.")
(defvar emms-info-ytdl-command
- "youtube-dl"
+ "yt-dlp"
"Command to run for emms-info-ytdl.")
+(defcustom emms-info-ytdl-using-torsocks
+ nil
+ "If t, use torsocks to get ytdl info")
+
(defun emms-info-ytdl (track)
"Set TRACK info using ytdl."
(when (and (eq (emms-track-type track) 'url)
@@ -65,8 +70,12 @@
(with-temp-buffer
(when (zerop
(let ((coding-system-for-read 'utf-8))
- (call-process emms-info-ytdl-command nil '(t nil) nil
- "-j" (emms-track-name track))))
+ (if emms-info-ytdl-using-torsocks
+ (call-process-with-torsocks
+ emms-info-ytdl-command nil '(t nil) nil "-j"
+ (emms-track-name track))
+ (call-process emms-info-ytdl-command nil '(t nil) nil
+ "-j" (emms-track-name track)))))
(goto-char (point-min))
(condition-case nil
(let ((json-fields (json-read)))