叶小贤 发表于 2020-6-10 11:53:05

想爬一个网站的数据,没思路...求助

http://ggzy.ah.gov.cn/login.do?method=beginlogin

一开始我想通过XPATH找信息,返回的response.text打开发现是 一堆JS....



然后我想直接通过post请求,发现请求体是payload,于是我查了网上资料
payload = {
    "callCount":1,
    "page": "/bulletininfo.do?method=showList&fileType=2&hySort=&bulletinclass=jy&num=1&bulletinType=01",
    "httpSessionId":"bd33a04f36df7a5e6615df863c83",
    "scriptSessionId": "24819EBA1C927DC31DDCA82698484FF0348",
    "c0-scriptName":"bulletinInfoDWR",
    "c0-methodName":"getPackListForDwr1",
    'c0-id':0,
    'c0-e1':'string:2',
    'c0-e2':'string:',
    'c0-e3':'string:jy',
    'c0-e4':'string:2',
    'c0-e5':'string:02',
    'c0-e6':'string:',
    'c0-e7':'string:',
    'c0-e8':'number:1',
    'c0-e9':'string:10',
    'c0-e10':'string:true',
    'c0-e11':'string:packTable',
    'c0-param0':'Object_Object:{id: reference: c0-e1, hySort: reference:c0-e2, bulletinclass: reference:c0-e3, fileType: reference:c0-e4, bulletinType: reference:c0-e5, district: reference:c0-e6, srcdistrict: reference:c0-e7, currentPage: reference:c0-e8, pageSize: reference:c0-e9, isPage: reference:c0-e10, tabId: reference:c0-e11}',
    'batchId':2
}

posturl = "http://ggzy.ah.gov.cn/dwr/call/plaincall/bulletinInfoDWR.getPackListForDwr1.dwr"

payloadHeader = {
'Host': 'ggzy.ah.gov.cn',
'Content-Type': 'text/plain'
}

r = requests.post(posturl, data=json.dumps(payload), headers=payloadHeader)
print(r.text)

返回:
throw 'allowScriptTagRemoting is false.';
//#DWR-REPLY
if (window.dwr) dwr.engine._remoteHandleBatchException({ name:'org.directwebremoting.extend.ServerException', message:'The specified call count is not a number' });
else if (window.parent.dwr) window.parent.dwr.engine._remoteHandleBatchException({ name:'org.directwebremoting.extend.ServerException', message:'The specified call count is not a number' });

有没有大神来试一下的。。。到底要怎么爬

小甲鱼的铁粉 发表于 2020-6-10 12:07:26

@Twilight6

老八秘制 发表于 2020-6-10 12:20:43

啊这,你和政0府有仇马

叶小贤 发表于 2020-6-10 12:37:53

老八秘制 发表于 2020-6-10 12:20
啊这,你和政0府有仇马

{:10_256:}我可是良民

小甲鱼的铁粉 发表于 2020-6-10 15:18:29

后缀gov的网站小心点爬哦{:10_256:}

xiaosi4081 发表于 2020-6-10 18:01:35

后缀gov的网站是政0府哟,小心点(建议不要爬了){:10_256:}

suchocolate 发表于 2020-6-10 18:15:51

你想爬这个网站的什么数据?
页: [1]
查看完整版本: 想爬一个网站的数据,没思路...求助