471,888 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,888 software developers and data experts.

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 1848
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 Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.