From 588b6031e152b031be1dee04c7b38938ea7eb706 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Thu, 21 Jan 2021 23:52:21 +0800 Subject: Regular updates In the course of configuring Emacs there are numerous changes to make. This is one regular step. --- view-conf.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'view-conf.el') diff --git a/view-conf.el b/view-conf.el index 945276f..4d4ff00 100644 --- a/view-conf.el +++ b/view-conf.el @@ -95,3 +95,26 @@ If ARG is '(16), view the battery information." (define-key view-mode-map (vector ?j) #'View-scroll-line-forward) (define-key view-mode-map (vector ?k) #'View-scroll-line-backward) + +;;; Convert downloaded videos from youtube to the URL again and copy +;;; the result. + +;;;###autoload +(defun durand-convert-youtube-video-to-url (video-name) + "Convert VIDEO-NAME to its original url." + (interactive (list (read-string "Video name: "))) + (cond + ((string-match "\\.[^.]+$" video-name) + ;; with extension + (kill-new + (concat + "https://www.youtube.com/watch?v=" + (substring-no-properties + video-name + (- (match-beginning 0) 11) + (match-beginning 0))))) + (t + ;; no extension + (kill-new + (concat "https://www.youtube.com/watch?v=" + (substring-no-properties video-name -11)))))) -- cgit v1.2.3-18-g5258