我只试了获取xml,即,你要先打开网站,搜test,dispaly settings选xml,200条,apple,用firefox获取这一页的postdata,再同样获取另一页的postdata,里面的不同就是翻页,下面是我试成了的,获取一页xml的代码,多是从网上找的,呵呵。import urllib,urllib2,cookielib
cookie = cookielib.CookieJar()
cookieProc = urllib2.HTTPCookieProcessor(cookie)
opener = urllib2.build_opener(cookieProc)
urllib2.install_opener(opener)
postdata = 'term=test&等一堆。。。'
header = {"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Encoding":"deflate","Accept-Language":"zh-cn,en-us;q=0.7,en;q=0.3","Connection":"keep-alive"}#去掉了Accept-Encodig里面的压缩,否则收到压缩后的乱码
tmp = urllib2.Request(url='居然不让发网址/pubmed/?term=test',headers=header)
tmp = urllib2.urlopen(tmp).read()#这两步随便搜了个test,获取了cookie
req = urllib2.Request(url='居然不让发网址/pubmed',data=postdata,headers=header)
res = urllib2.urlopen(req).read()