469,282 Members | 2,008 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

extracting title and/or summary of a website

hello friends,
is there any lib in python that provides a mechanism to get the title
of a web page ? also is there anything available to get a nice summary
like the way google shows below every link ?
thanks
ravinder thakur
Jun 27 '08 #1
1 1807
On May 22, 3:28 am, रवींदर *ाकुर (ravinder thakur)
<ravindertha...@gmail.comwrote:
is there any lib in python that provides a mechanism to get the title
of a web page ? also is there anything available to get a nice summary
like the way google shows below every link ?
It's not part of the standard lib but I really like using
BeautifulSoup for this kind of thing:

from urllib import urlopen
from BeautifulSoup import BeautifulSoup

html = urlopen("http://www.google.com").read()
soup = BeautifulSoup(html)

print soup.title # '<title>Google</title>'
print soup.title.renderContents() # 'Google'

http://www.crummy.com/software/BeautifulSoup/

- alex23
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.