浙江省事业单位和公务员成绩查询脚本与server酱推送
#coding:utf-8
import requests
import time
import os
cjurl='http://qssy.zjks.com/tyzpwb/stucx/cxbscj.htm?userid=***********&bmid=***********&examid=*******&jsessionid=&mydepid=&dqssds=13304'
sleeptime=2
def getmidstring(html, start_str, end):
start = html.find(start_str)
if start >= 0:
start += len(start_str)
end = html.find(end, start)
if end >= 0:
return html[start:end].strip()
def sendwx(message):
sendurl='https://sctapi.ftqq.com/SCT212322TvzuKmn010ddhXXXXXXXXXXX.send' #方糖推送链接:https://sctapi.ftqq.com/+key
data={
'title':'出成绩了',
'desp':str(message)
}
resp=requests.post(url=sendurl,json=data)
#sendwx('text')
while(1):
try:
os.system('date')
resp=requests.get(url=cjurl).text
if("成绩还未发布" in resp or '502' in resp):
info=getmidstring(resp,'name="msg" value="','"')
print(info)
time.sleep(sleeptime)
else:
sendwx(resp)
info=getmidstring(resp,'name="msg" value="','"')
print(info)
sendwx(info)
time.sleep(sleeptime)
break
except:
print('err')
time.sleep(sleeptime)没做提取,直接发送html,大概能看到成绩,填写server酱,几秒钟查一次,出成绩了就推送到微信上

请求的链接这里取
