当前位置:编程学习 > C#/ASP.NET >>

问一个关于网页抓取的问题:asp网站,用__doPostBack(eventTarget, eventArgument)交后台处理翻页

问一个关于网页抓取的问题:
asp网站,用__doPostBack(eventTarget, eventArgument)交后台处理翻页
我用pose提交eventTarget,eventArgument参数,但只能前页,后页和第一页,最后一页。想做多线程,怎么能定位到具体某一页进行crawling啊,达人出来解解惑啊。。。在线等! --------------------编程问答-------------------- 自己顶一下。。。 --------------------编程问答-------------------- 有达人在没啊。。。 --------------------编程问答-------------------- 还没解决。。。 --------------------编程问答-------------------- 可以提交页面值,是个什么样的参数我忘记了,你把js代码分解以下,可以测试出来
直接通过url+参数提交页面信息 --------------------编程问答-------------------- 这是翻页的post的header
Cookie=.ASPXANONYMOUS=MPNVTgMMyAEkAAAAODgyZmMyZDYtZjVjNi00MjFjLWIxNWUtNzljYjhlMDlkYzI0EKQv5QgEj5t2o083p2KsQM_U5rI1; ASP.NET_SessionId=cdcqepqpwoj4cq45p0y22l45; www.sofang.com=sign=30
Content-Type=application/x-www-form-urlencoded
Content-Length=6249
POSTDATA=__EVENTTARGET=ctl00%24ContentPlaceHolder1%24lbnNextPage&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=%2FwEPDwUKLTg0Mjk1OTU5MQ8WBB4JUGFnZUNvdW50AkgeCVBhZ2VJbmRleGYWAmYPZBYCZg9kFgYCAQ8PFgIeBFRleHQFBuWkqea0pWRkAgUPZBYGAgEPEGRkFgFmZAIDDxAPFgYeDkRhdGFWYWx1ZUZpZWxkBQN6aGkeDURhdGFUZXh0RmllbGQFBHRleHQeC18hRGF0YUJvdW5kZ2QQFQcM5Lu35qC85LiN6ZmQCjEwMDDku6XkuIsJMTAwMC0yMDAwCTIwMDAtMzAwMAkzMDAwLTQwMDAJNDAwMC01MDAwCjUwMDDku6XkuIoVBwEwATEBMgEzATQBNQE2FCsDB2dnZ2dnZ2dkZAIFDxAPFgYfBAUGbl9sYXRlHwMFAmlkHwVnZBAVFAzljLrln5%2FkuI3pmZA05ZKM5bmzICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDTopb%2FpnZIgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNOWMl%2Bi%2BsCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA05aSn5rivICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDTljZflvIAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNOays%2BS4nCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA05rKz6KW%2FICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDTmsrPljJcgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNOa0peWNlyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA057qi5qGlICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDTloZjmsr0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNOaxieayvSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA05Lic5Li9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDTlrp3lnbsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNOiTn%2BWOvyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA05q2m5riFICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDTlroHmsrMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgNOmdmea1tyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA15byA5Y%2BR5Yy6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAVFAzljLrln5%2FkuI3pmZAEMTEyMwQxMTI0BDExMjUEMTEyNgQxMTI3BDExMjgEMTEyOQQxMTMwBDExMzEEMTEzMgQxMTMzBDExMzQEMTEzNQQxMTM2BDExMzcEMTEzOAQxMTM5BDExNDAEMTE0MRQrAxRnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2RkAg8PZBYKAgEPPCsACQEADxYEHghEYXRhS2V5cxYAHgtfIUl0ZW1Db3VudAIPZBYeAgEPZBYCZg8VBjTlkozlubMgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgBDHlsYUU5p%2Bz5bee6Lev55uK5a%2B%2F6YeMICAIMjAwNy04LTIyMTM1MCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAFNDUwOTlkAgIPZBYCZg8VBjXlvIDlj5HljLogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAQz5bGFFuW8gOWPkeWMui3nrKzkuInlpKfooZcIMjAwNy04LTIyMzUwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAFNDUwNjNkAgMPZBYCZg8VBjXlvIDlj5HljLogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAQx5bGFFuW8gOWPkeWMui3nrKzkuInlpKfooZcIMjAwNy04LTIyMjMwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAFNDUwNjJkAgQPZBYCZg8VBjXlvIDlj5HljLogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAQx5bGFGOW8gOWPkeWMuuesrOS4ieWkp%2Bihl%2Be%2FoAgyMDA3LTgtMjIzMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAU0NTA2MWQCBQ9kFgJmDxUGNeW8gOWPkeWMuiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgBDHlsYUW5byA5Y%2BR5Yy6LeesrOS4ieWkp%2BihlwgyMDA3LTgtMjIzMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAU0NTA2MGQCBg9kFgJmDxUGNOS4nOS4vSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAEMuWxhRjkuJzkuL3ljLrpm6rojrLmoaXml4HkuJwIMjAwNy04LTEyMTIwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAFNDUwMjZkAgcPZBYCZg8VBjTloZjmsr0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgBDLlsYUU5aSW5rup5YWs5Zut6ZmE6L%2BRICAIMjAwNy04LTEyOTUwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAFNDUwMjVkAggPZBYCZg8VBjTmsrPopb8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgBDLlsYUY5rC45a6J6YGT5bm%2F5Lic6Lev5qGD5ZutCDIwMDctOC0xMjMyMDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgBTQ0OTk3ZAIJD2QWAmYPFQY05rKz6KW%2FICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAQy5bGFFOS9k%2BWMl%2BWNjuWkj%2BacquadpSAgCDIwMDctOC0xMjI1MDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgBTQ0OTk0ZAIKD2QWAmYPFQY05rKz6KW%2FICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAQx5bGFGOe0q%2BmHkeWxsei3r%2Bm7keeJm%2BWfjumBkwgyMDA3LTgtMTIyMDAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAU0NDk5M2QCCw9kFgJmDxUGNOays%2BilvyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAEMuWxhRjmsLjlronpgZPlub%2FkuJzot6%2FmoYPlm60IMjAwNy04LTEyMjAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAFNDQ5OTJkAgwPZBYCZg8VBjTmsrPopb8gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgBDPlsYUY5Y%2BL6LCK6Lev5rC45a6J6YGT5Zu05aCkCDIwMDctOC0xMjU1MDAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgBTQ0OTkxZAIND2QWAmYPFQY05rKz6KW%2FICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAQy5bGFGOawuOWuiemBk%2BW5v%2BS4nOi3r%2Bahg%2BWbrQgyMDA3LTgtMTIzNTAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAU0NDk4OWQCDg9kFgJmDxUGNOays%2BilvyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAEMuWxhQ7mtKXmsrPml4EgICAgIAgyMDA3LTgtMTIyNTAwICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAU0NDk4NmQCDw9kFgJmDxUGNOWNl%2BW8gCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAEMuWxhRLkuIflvrfluoTlpKfooZcgICAIMjAwNy04LTEyMzAwMCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAFNDQ5ODRkAgMPDxYCHwIFBDEwNzhkZAIFDw8WAh8CBQI3MmRkAgcPDxYCHwIFATFkZAILDw8WAh4HRW5hYmxlZGhkZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAQUlY3RsMDAkV2Fpc2hlbmdfc2VhcmNoMV8xJEltYWdlQnV0dG9uMUqvQgZnixBjEjG7Kd8Vm3EvGoTX&ctl00%24Waisheng_search1_1%24DropDownList1=1&ctl00%24Waisheng_search1_1%24DropDownList4=0&ctl00%24Waisheng_search1_1%24DropDownList2=%C7%F8%D3%F2%B2%BB%CF%DE&ctl00%24Waisheng_search1_1%24DropDownList3=7&ctl00%24Waisheng_search1_1%24TextBox1=&ctl00%24TextBox1=&ctl00%24TextBox2=&__EVENTVALIDATION=%2FwEWLwK64aWLCQKO3%2FvdDAKBsNEzAoCw0TMCg7DRMwKCsNEzAoWw0TMChLDRMwKesK0wAoGwrTACgLCtMAKDsK0wAoKwrTAChbCtMAKEsK0wAqGi%2FrYDAtHfpv0GAtHf2pgNAtHfzrcEAtHf4tIMAtHflu4LAtHfytYGAtHf%2Fu0NAvS2zZoCAvS24bEJAvS2lc0BAvS2iegIAvS2vYcHAvS20aIOAvS2xfkGAvS2%2BZQNAvS2rf0IAvS2wZgHApuMr4EEApuMw9wMAoew2TMCgbCpMAKDsJkwApmwmTAC59%2Fw4gkCqMPAgQ8Ct97BiQECt961iQEC5fe37Q0CoZX%2F1AkC54aBoAkCu5SZswU1fE0aW2dwUoo%2FysNt7cyAo6pEwA%3D%3D
--------------------编程问答-------------------- 咋整啊。。。? --------------------编程问答-------------------- 怎么翻页都做不到了啊?以下是代码。。。

import httplib
import urllib

host = 'shanghai.sofang.com'
page = '/fwcz-list.aspx'

respstrlist=[]  
http=httplib.HTTPConnection(host)

header = {'Cookie':'.ASPXANONYMOUS=ohm4u30LyAEkAAAANzc4Y2ZmYmUtMGY3ZC00ZThlLWEwNjUtNzM2MDI4NTZlYjA4Bd0xYuF7uRaDfjS0VrJa_nsJDus1; ASP.NET_SessionId=cwqbyamnoieekorme402vmys; www.sofang.com=sign=3'}

params = '__EVENTTARGET=ctl00%24ContentPlaceHolder1%24lbnNextPage&__EVENTARGUMENT=&__LASTFOCUS=&ctl00%24Waisheng_search1_1%24DropDownList4=0&ctl00%24Waisheng_search1_1%24DropDownList2=%C7%F8%D3%F2%B2%BB%CF%DE&ctl00%24Waisheng_search1_1%24DropDownList3=7&ctl00%24Waisheng_search1_1%24TextBox1=&ctl00%24TextBox1=&ctl00%24TextBox2=&__EVENTVALIDATION=%2FwEWLwK64aWLCQKO3%2FvdDAKBsNEzAoCw0TMCg7DRMwKCsNEzAoWw0TMChLDRMwKesK0wAoGwrTACgLCtMAKDsK0wAoKwrTAChbCtMAKEsK0wAqGi%2FrYDAtHfpv0GAtHf2pgNAtHfzrcEAtHf4tIMAtHflu4LAtHfytYGAtHf%2Fu0NAvS2zZoCAvS24bEJAvS2lc0BAvS2iegIAvS2vYcHAvS20aIOAvS2xfkGAvS2%2BZQNAvS2rf0IAvS2wZgHApuMr4EEApuMw9wMAoew2TMCgbCpMAKDsJkwApmwmTAC59%2Fw4gkCqMPAgQ8Ct97BiQECt961iQEC5fe37Q0CoZX%2F1AkC54aBoAkCu5SZswU1fE0aW2dwUoo%2FysNt7cyAo6pEwA%3D%3D'

http.request('POST',page,params,header)
resp=http.getresponse()
print resp.status, resp.reason
respstrlist=resp.read().splitlines()
http.close()
f = file('testsofang1.txt','w')
for con in respstrlist:
    f.write(con+'\n')

f.close()
--------------------编程问答-------------------- 想问下这个问题你解决了吗,我现在是个学生也遇到这个问题,联系我 qq:457014050,谢谢
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,