karthink / elfeed-tube

Youtube integration for Elfeed, the feed reader for Emacs
The Unlicense
252 stars 12 forks source link

How to set a proxy for elfeed-tube to play videos with mpv? #34

Open IceAsteroid opened 5 days ago

IceAsteroid commented 5 days ago

Hi, guys!

[Fix typo]: In my environment, I've set up proxy settings in init.el for emacs, but I don't set environmental variables http_proxy and https_proxy in my shell for my use case, it works for most situations in Emacs.

For elfeed, I set the following variable, and it works

      (setq elfeed-curl-extra-arguments '("--proxy"
                                          "http://127.0.0.1:8118"))

How to set up an http proxy for elfeed-tube?

Here's my configuration for proxy:

(defun my-setup/proxy ()
  (setq url-proxy-services '(("no_proxy" . "127.0.0.1")
                             ("http" . "127.0.0.1:8118")
                             ("https" . "127.0.0.1:8118")))

  ;; For packages that use `plz.el’ for networking
  ;; https://github.com/alphapapa/plz.el/issues/37
  (setq plz-curl-default-args '("--silent"
                                "--compressed"
                                "--location"
                                "--proxy" "http://127.0.0.1:8118"))

  ;; For elfeed with curl to use proxy
  (defun my-setup/elfeed-proxy ()
    (with-eval-after-load 'elfeed
      (setq elfeed-curl-extra-arguments '("--proxy"
                                          "http://127.0.0.1:8118"))
      (with-eval-after-load 'elfeed-tube
        (setq elfeed-tube-mpv-options
              '("--cache=yes"
                "--force-window=yes"
                "--stream-lavf-o-append=http_proxy=http://127.0.0.1:8118"))
        )))
  (my-setup/elfeed-proxy)
  )
(my-setup/proxy)
IceAsteroid commented 4 days ago

Here's the log:

[2024-11-03 22:45:34] [error]: [Sponsorblock][video:Philosophy: social m]: HTTP 404
[2024-11-03 22:45:46] [error]: [Description][video:Live excerpt: commen][invidious.jing.rocks/api/v1/videos/pdtykzn6tS8?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 0/2)
[2024-11-03 22:45:46] [error]: [Description][video:Live excerpt: commen][inv.nadeko.net/api/v1/videos/piPKG_W_Wio?fields=videoThumbnails,description,lengthSeconds]: HTTP 503 (attempt 0/2)
[2024-11-03 22:45:47] [error]: [Description][video:Vlog: the hut's land][invidious.jing.rocks/api/v1/videos/b1agdN6Qf0U?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 0/2)
[2024-11-03 22:45:47] [error]: [Description][video:Vlog: firmware-level][invidious.jing.rocks/api/v1/videos/DCJz9VnPIW0?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 0/2)
[2024-11-03 22:45:47] [error]: [Description][video:Philosophy: why are ][invidious.jing.rocks/api/v1/videos/0Yg1sWYxF2o?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 0/2)
[2024-11-03 22:45:47] [error]: [Description][video:Philosophy: seeking ][invidious.jing.rocks/api/v1/videos/DSuf88CH3TA?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 0/2)
[2024-11-03 22:45:52] [error]: [Description][video:Live excerpt: commen][invidious.jing.rocks/api/v1/videos/piPKG_W_Wio?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 1/2)
[2024-11-03 22:45:52] [error]: [Description][video:Vlog: firmware-level][invidious.jing.rocks/api/v1/videos/DCJz9VnPIW0?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 1/2)
[2024-11-03 22:45:52] [error]: [Description][video:Philosophy: why are ][inv.nadeko.net/api/v1/videos/0Yg1sWYxF2o?fields=videoThumbnails,description,lengthSeconds]: HTTP 503 (attempt 1/2)
[2024-11-03 22:45:52] [error]: [Description][video:Philosophy: seeking ][invidious.jing.rocks/api/v1/videos/DSuf88CH3TA?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 1/2)
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Live excerpt: commen]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Live excerpt: commen]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Live excerpt: commen]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:'Ask me anything' li]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Philosophy: my "alla]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Philosophy: Hestia, ]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Philosophy: integrit]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Vlog: the hut's land]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Emacs: commands in p]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Philosophy: the thre]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Philosophy: social m]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Vlog: firmware-level]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Philosophy: why are ]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Vlog: status update ]: HTTP 404
[2024-11-03 22:45:54] [error]: [Sponsorblock][video:Philosophy: seeking ]: HTTP 404
[2024-11-03 22:45:56] [error]: [Description][video:Vlog: firmware-level][invidious.jing.rocks/api/v1/videos/DCJz9VnPIW0?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 2/2)
[2024-11-03 22:45:56] [error]: [Description][video:Philosophy: why are ][inv.nadeko.net/api/v1/videos/0Yg1sWYxF2o?fields=videoThumbnails,description,lengthSeconds]: HTTP 503 (attempt 2/2)
[2024-11-03 22:45:56] [error]: [Description][video:Philosophy: seeking ][invidious.jing.rocks/api/v1/videos/DSuf88CH3TA?fields=videoThumbnails,description,lengthSeconds]: HTTP 500 (attempt 2/2)
karthink commented 2 days ago

You need to add a youtube-dl or yt-dlp proxy argument when calling mpv, since mpv uses those to play youtube/invidious videos. From the mpv man page it looks like this is --ytdl-raw-options. These proxy args can be placed in the variable elfeed-tube-mpv-options.