使用python进行抓取的一个例子
from mechanize import Browser
br = Browser() br.addheaders = [('User-agent', 'xxxxx'),] br.set_handle_robots(False)# use proxybr.set_proxies({"http":"user_name:passwd@host:port"})
br.open(url)
br.response().read()
referer:http://www.reyoung.me/index.php/2012/08/08/%E7%BF%BB%E8%AF%91%E4%BD%BF%E7%94%A8python%E6%A8%A1%E4%BB%BF%E6%B5%8F%E8%A7%88%E5%99%A8%E8%A1%8C%E4%B8%BA/