blob: 12e5c97b2fa88945026305bf851c5ad352a07f59 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
;;; my-web.el --- Functions related to web interactions
;;; Commentary:
;;; Code:
(require 'my-strings)
(defun fcuny/get-page-title (url)
"Make URL into an 'org-mode' link."
(let ((title))
(with-current-buffer (url-retrieve-synchronously url)
(goto-char (point-min))
(re-search-forward "<title>\\([^<]*\\)</title>" nil t 1)
(setq title (match-string 1))
(goto-char (point-min))
(re-search-forward "charset=\\([-0-9a-zA-Z]*\\)" nil t 1)
(my/string-replace " " " "
(decode-coding-string title 'utf-8))
(concat "[[" url "][" title "]]"))))
(provide 'my-web)
;;; my-web.el ends here
|