Xah Talk Show 2024-01-08 Ep528 Trackball, Write Emacs Lisp Command to Change Link to Dead Link

(defun xah-html-make-iframe-defunct ()
  "Make the HTML iframe under cursor to a defunct form.

for example
<iframe src=\"https://www.youtube.com/abc\" allowfullscreen></iframe>
becomes
<s>https://www.youtube.com/abc</s>

Version: 2024-01-08"
  (interactive)
  (let (xp1 xp2 xwholeLinkStr xresultStr xurl)
    (progn
      (forward-word)
      (progn
        ;; get the boundary of opening tag
        ;; <iframe src="https://www.youtube.com/embed/-vbvIJrF5dk" allowfullscreen></iframe>
        (search-backward "<iframe ")
        (setq xp1 (point))
        (search-forward "</iframe>")
        (setq xp2 (point))
        (setq xwholeLinkStr (buffer-substring-no-properties xp1 xp2))
        (with-temp-buffer
          ;; generate replacement text
          (insert xwholeLinkStr)
          (goto-char (point-min))
          (re-search-forward "src=\"\\([^\"]+?\\)\"")
          (setq xurl (match-string 1))
          (setq xresultStr (format "<s>%s</s>" xurl)))))
    (delete-region xp1 xp2)
    (goto-char xp1)
    (insert xresultStr)))