summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yeetube.el14
1 files changed, 10 insertions, 4 deletions
diff --git a/yeetube.el b/yeetube.el
index 3e1f531..9a7ae01 100644
--- a/yeetube.el
+++ b/yeetube.el
@@ -159,12 +159,18 @@ It's recommended you keep it as the default value."
(message "mpv play/pause"))
(error "To use this function you need to have mpv installed & set yeetube-player to the default value")))
-;; this is a quick "duck-tape" fix.
+;; Usually titles from youtube get messed up,
+;; This should be fix some of the common issues.
(defun yeetube-fix-title (title)
"Adjust TITLE."
- (replace-regexp-in-string "&" "&"
- (replace-regexp-in-string """ "\""
- (replace-regexp-in-string "'" "'" title))))
+ (let ((replacements '(("&" . "&")
+ (""" . "\"")
+ ("'" . "'")
+ ("u0026" . "&"))))
+ (mapc (lambda (replacement)
+ (setq title (replace-regexp-in-string (car replacement) (cdr replacement) title)))
+ replacements)
+ title))
(defun yeetube-insert-content (prefix url video-titles video-ids)
"Insert video links with titles into the buffer.