-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxqyy.py
27 lines (27 loc) · 1.02 KB
/
xqyy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import re
import urllib.request as urllib2
import datetime
import csv
header={"User-Agent" : "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0;"}#模仿浏览器
request = urllib2.Request('https://healthcare.xqyk024.com/consult/diagnosis/doctors?pageNumber=1&pageSize=20&order=0',headers=header)
response = urllib2.urlopen(request)
buff = response.read()
html = buff.decode()
#print(html)
result = re.findall("consultCount\":\d+",html)
result_string = ",".join(result)
result_score_list = re.findall(r"\d+",result_string)
result_int = list(map(int,result_score_list))
result_sum=sum(result_int)
name = re.findall("employeeName\":\"[\u4E00-\u9FA5]+",html)
name_string = ",".join(name)
name_list = re.findall(r"[\u4E00-\u9FA5]+",name_string)
name_result = []
for i in range(0,len(name_list)):
name_result1 = name_list[i] + ' ' + result_score_list[i]
name_result.append(name_result1)
today = datetime.date.today()
print(today,name_result)
#print(name_list)
#print(result_int)
print(today,result_sum)