|
From: | filebat Mark |
Subject: | Re: How to get title of web page by url? |
Date: | Wed, 28 Jul 2010 21:44:49 +0800 |
filebat Mark <filebat.mark@gmail.com> writes:
> Such as, given "http://www.emacswiki.org/emacs/Git", we will get the title
> of this web page, which is "EmacsWiki: Git:".
>
> Function of w3m-current-title is quite close, but a standalone lisp function
> is much preferred.
Using the url.el package,
(defun www-get-page-title (url)
(with-current-buffer (url-retrieve-synchronously url)
(goto-char 0)
(re-search-forward "<title>\\(.*\\)<[/]title>" nil t 1)
(match-string 1)))
(www-get-page-title "http://www.emacswiki.org/emacs/Git")
=> "EmacsWiki: Git"
hth,
Thamer
[Prev in Thread] | Current Thread | [Next in Thread] |