xah talk show 2019-08-19 Deseret/Shavian Alphabets, IPA, font size, fugue, elisp coding youtube html

xah talk show 2019-08-19 Deseret/Shavian Alphabets, IPA, font size, fugue, elisp coding youtube html

emacs lisp coding start at 1:07:18

topics talked:

(defun xah-html-youtube-to-text-region ()
  "remove embedded YouTube html block to url and caption.
Version 2019-08-19"
  (interactive)
  (let (
        (p1 (region-beginning))
        (p2 (region-end))
        p3 p4
        figCapText
        ytUrl
        )
    (save-restriction
      (narrow-to-region p1 p2)
      (let ((case-fold-search t))
        (goto-char (point-min))
        (search-forward-regexp "src=\"\\([^\"]+\\)\"" )
        (setq ytUrl (match-string 1 ))

        (goto-char (point-min))
        (search-forward "<figcaption>" )
        (setq p3 (point))

        (goto-char (point-min))
        (search-forward "</figcaption>" )
        (search-backward "</figcaption>")
        (setq p4 (point))

        (setq figCapText (buffer-substring-no-properties p3 p4))

        (delete-region (point-min) (point-max))

        (insert ytUrl)

        (goto-char (point-min))
        (search-forward "embed/" )
        (replace-match "")

        (insert "watch?v=")

        (goto-char (point-min))
        (search-forward "rel=0" )
        (replace-match "")

        (insert figCapText "\n\n")))))

If you have a question, put $5 at patreon and message me.