Link miner bot
This bot will extract all the link from a fetched web content and displays it on the screen. Not only the word having the link, this bot will extract the URL to where it points. Here is the code..
import mechanize
def linkminer():
browser = mechanize.Browser(factory=mechanize.RobustFactory())
browser.set_handle_robots(False)
browser.open("http://www.minerbots.blogspot.in/") #you can give your url
html = browser.response().readlines()
for link in browser.links():
print link.text, link.url
print
browser = mechanize.Browser(factory=mechanize.RobustFactory())
browser.set_handle_robots(False)
browser.open("http://www.minerbots.blogspot.in/") #you can give your url
html = browser.response().readlines()
for link in browser.links():
print link.text, link.url
No comments:
Post a Comment