karthink / elfeed-tube

Youtube integration for Elfeed, the feed reader for Emacs
The Unlicense
258 stars 13 forks source link

(wrong-type-argument arrayp nil) in inserting captions in the elfeed entry buffer #7

Closed Gleek closed 1 year ago

Gleek commented 2 years ago

Hello, Thank you for sharing this as a package. I've just started using it and have run into issues when downloading a custom subtitle (not the auto generated one, which works fine). I'm attaching a trimmed backtrace below as the full backtrace is very large. Let me know in case this isn't sufficient and you need a full one.

This is the code I use:

(use-package elfeed-tube
  :after elfeed
  :bind (:map elfeed-show-mode-map
              ("F" . elfeed-tube-fetch)
              ([remap save-buffer] . elfeed-tube-save)
              :map elfeed-search-mode-map
              ("F" . elfeed-tube-fetch)
              ([remap save-buffer] . elfeed-tube-save))
  :commands (elfeed-tube-setup)
  :config
  (elfeed-tube-setup)
  (setq elfeed-tube-captions-languages '("en-gb" "en" "english" "english (auto generated)")))

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  replace-regexp-in-string("\n" " " nil)
  (propertize (replace-regexp-in-string "\n" " " text) 'face (elfeed-tube--caption-get-face type) 'type type)
  (cons time (propertize (replace-regexp-in-string "\n" " " text) 'face (elfeed-tube--caption-get-face type) 'type type))
  (list (cons time (propertize (replace-regexp-in-string "\n" " " text) 'face (elfeed-tube--caption-get-face type) 'type type)))
  (nconc para (list (cons time (propertize (replace-regexp-in-string "\n" " " text) 'face (elfeed-tube--caption-get-face type) 'type type))))
  (setq para (nconc para (list (cons time (propertize (replace-regexp-in-string "\n" " " text) 'face (elfeed-tube--caption-get-face type) 'type type)))))
  (while (consp --cl-var--) (setq --cl-var-- <trimmed>) (setq chapter <trimmed>) <trimmed> (setq para (nconc para (list (cons time (propertize (replace-regexp-in-string "\n" " " text) 'face (elfeed-tube--caption-get-face type) 'type type))))) <trimmed>)
  (let* <trimmed>)
  (let ((caption-ordered <trimmed>) (inhibit-read-only t)) (goto-char (point-max)) (insert "\n" (propertize "Transcript:" 'face 'message-header-name) "\n\n") (let* <trimmed>))
  (if (and (listp caption) (eq (car-safe caption) 'transcript)) <trimmed> (elfeed-tube-log 'debug "[Captions][video:%s][Not available]" (or <trimmed> "")))
  elfeed-tube--insert-captions((transcript nil (text ((start . "58.75") (dur . "1.57")) "Can I ask more questions? - Please.") <trimmed> (text ((start . "214.64") (dur . "0.52")) "Sure.") ...))
  (progn (if (not <trimmed> (progn (kill-region (point) (point-max)))) (elfeed-tube--insert-captions caption) (setq insertions (cons 'caps insertions)))
  (if caption (progn <trimmed> (setq insertions (cons 'caps insertions))))
  (let* ((c (and t (elfeed-tube-include-p 'captions))) (caption <trimmed)) (if caption <trimmed>))
  (let ((elfeed-db-directory elfeed-tube--captions-db-dir)) <trimmed>)
  (let* <trimmed>)
  (save-current-buffer <trimmed>)
  (progn (save-current-buffer <trimmed>))
  (if (elfeed-tube--same-entry-p entry intended-entry) <trimmed>)
  (if intended-entry (if (elfeed-tube--same-entry-p entry intended-entry) <trimmed>))
  (let* <trimmed>)
  elfeed-tube-show()
  apply(elfeed-tube-show nil)
  elfeed-show-refresh--mail-style()
  funcall-interactively(elfeed-show-refresh--mail-style)
  elfeed-show-refresh()
karthink commented 2 years ago

This backtrace is fine, but I'd like to reproduce the error if possible. Can you provide the link to the Youtube video that produced this error?

It'll also help to know your country, since the captions HTML that Youtube serves up (that elfeed-tube parses) differs by region. I can check using a VPN.

dhruvSHA256 commented 2 years ago

Hey, I ran into this issue too. No transcript or description is show for this video (elfeed-tube doesnt show any error) and elfeed=tube shows the error mentioned above for this video

elfeed-tube config:

(use-package elfeed-tube
  :ensure t
  :after elfeed
  :init
  (setq elfeed-tube-auto-save-p t
        elfeed-tube-auto-fetch-p t
        elfeed-tube-thumbnail-size 'large)
  :config
  (elfeed-tube-setup))

(use-package elfeed-tube-mpv
  :ensure t
  :after elfeed)

Backtrace:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  signal(wrong-type-argument (arrayp nil))
  (closure (... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) nil (signal ... ...))()
  funcall((closure ... nil ...))
  (if (funcall fetched-p) (progn (elfeed-tube-show (or entry elfeed-show-entry))))
  (closure ((entry . #s(elfeed-entry :id ("www.youtube.com" . "yt:video:cC6HFd1zcbo") :title "Did I Pick The Right Database???" :link "https://www.youtube.com/watch?v=cC6HFd1zcbo" :date 1660541138.0 :content nil :content-type nil :enclosures nil :tags (tech yt) :feed-id "https://www.youtube.com/feeds/videos.xml?channel_i..." :meta (:authors ((:name "Theo - ping․gg" :uri "https://www.youtube.com/channel/UCbRP3c757lWg9M-U7..."))))) cl-struct-elfeed-tube-item-tags t) (fetched-p) (if (funcall fetched-p) (progn (elfeed-tube-show (or entry elfeed-show-entry)))))((closure ... nil ...))
  apply((closure ... ... ...) (closure ... nil ...))
  timer-event-handler([t 25338 38642 984250 nil ... ... nil 244000 nil])
karthink commented 2 years ago

@dhruvSHA256: The second issue (elfeed-tube errors out) should be fixed in 18d89f19, please test?

@Gleek: Could you update and try it?

The first issue (missing description/caption) is going to be harder to fix. It looks like some API calls are failing because the video is age-restricted. I'll work on finding a solution.

dhruvSHA256 commented 2 years ago

@karthink tested it, error is fixed now thanks for the response and this awesome package

karthink commented 1 year ago

Closing this issue since the remaining problem is tracked by #10.