爬虫——中国工商网点

 1 import requests
 2 import json
 3 from pyquery import  PyQuery as pq
 4 
 5 url = 'http://www.icbc.com.cn/ICBCDynamicSite2/LBS/nets/netsappointreal.aspx'
 6 headers = {
 7     'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.38'
 8 }
 9 response = requests.post(url, headers=headers).text
10 doc = pq(response)
11 c = doc("#__VIEWSTATE").attr('value')
12 print(c)
13 data={
14 "sym": "sym|btnReq_Info",
15 "__EVENTTARGET": "",
16 "__EVENTARGUMENT": c,
17 "searchparas": "icbc1:运城市,河津市,1,,,1",
18 "bbb": "",
19 "__ASYNCPOST": True,
20 "btnReq_Info":""
21 }
22 response2 = requests.post(url, headers=headers,data=data).text
23 doc = pq(response2)
24 tet = doc("#jsdatapr").text()
25 jdata = json.loads(tet)
26 # print(tet)
27 for k,v in jdata['ICBCPointInfomationList'].items():
28     print(v['stru_fname'])

 

posted @ 2022-04-17 19:09  东方不败--Never  阅读(52)  评论(0编辑  收藏  举报