help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get title of web page by url?


From: Thamer Mahmoud
Subject: Re: How to get title of web page by url?
Date: Wed, 28 Jul 2010 08:08:55 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]