diff options
-rw-r--r-- | yeetube.el | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -221,6 +221,18 @@ then for item." ("u0026" . "&") ("\\\\" . "")) "Unicode character replacements.") + +;; Usually titles from youtube get messed up, +;; This should fix some of the common issues. +(defun yeetube---fix-title (title) + "Adjust TITLE." + (mapc (lambda (replacement) + (setf title (replace-regexp-in-string (car replacement) (cdr replacement) title))) + yeetube--title-replacements) + (if yeetube-buffer-display-emojis + title + (yeetube-buffer-strip-emojis title))) + (defun yeetube-get-content () "Get content from youtube." (setf yeetube-content nil) @@ -230,7 +242,8 @@ then for item." (let ((videoid (buffer-substring (+ (point) 3) (- (search-forward ",") 2)))) (unless (member videoid (car yeetube-content)) (yeetube-get-item "title") ;; Video Title - (let ((title (buffer-substring (+ (point) 3) (- (search-forward ",\"") 5)))) + (let ((title (yeetube---fix-title + (buffer-substring (+ (point) 3) (- (search-forward ",\"") 5))))) (unless (member title (car yeetube-content)) (yeetube-get-item "viewcounttext") ;; View Count (let ((view-count (buffer-substring (+ (point) 3) (- (search-forward " ") 0)))) |