Jump to content

I need help,please help me how to collect this page from internet by Python script

- - - - -

  • Please log in to reply
No replies to this topic

#1
wqjwftcaqr

wqjwftcaqr

    Newbie

  • Members
  • Pip
  • 8 posts
my code:

#-*-coding:cp936-*-

import urllib,urllib2


values={'strWhere':'主分类号=(a61%)','strPage':'5','area':'cn','strStartPage':'1','uname':'guest','pwd':'',\

        'uid':'','sessionid':'D1F2B7D0F863C6CEBA96F84E196BD4B4','strStat':'','iOption':'2','iHitPointType':'115','index':'7'}#,'lengpair':'%s|%s'%(lin,lout)}

url='http://search.cnipr.com/search.do?method=post'

data=urllib.urlencode(values)

req=urllib2.Request(url,data)

req.add_header('User-Agent', "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)")

response=urllib2.urlopen(req)

outfile=open('new1.html','w')

outfile.write(response.read())

outfile.close()


raw_input('finished')

page code:
Attached File  search[1].txt   37.67K   137 downloads[ATTACH]3712[/ATTACH]

Edited by Roger, 14 February 2012 - 01:59 PM.
added code tags





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users