extracting title and/or summary of a website

  • Thread starter रवींदर ठाकà¥à¤° (ravinder thakur
  • Start date
À

रवींदर ठाकà¥à¤° (ravinder thakur

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
 
A

alex23

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top