好友
阅读权限30
听众
最后登录1970-1-1
|
本帖最后由 xhtdtk 于 2021-9-19 16:07 编辑
先分享我操作的视频:
界面填写报名信息:https://www.bilibili.com/video/BV1xf4y1P78M/
报名快速填充信息:https://www.bilibili.com/video/BV12M4y1g7mt/
网页个是本地网址,加之虚构的信息,所以填写出生日期时会报错和志愿会出错
一、今年广东省成考报名惨状
今年成考网络报名时间为9.11至9.17,第一天广东省所有机构早上9点开始填写学生基本资料拿预报名号并绑定手机。早上进入网页顺畅,但一到下午加载缓慢浪费了四个小时之多,报名进度缓慢。到了晚上考位开始迅速减少,晚上10点半我们市的考位已经所剩无几,实在心急如焚。
而且还看到了惊人的消息,贴个图:
为了明年能帮学生们顺利报考,于是我制作了一些帮助报名的工具(注意注意注意不是拿来抢号的,一个小工具而已),本次是我第一次制作稍微复杂的界面。
二、录入工具界面及介绍(报名第一步)
(左边是我设计的界面,右边是广东省考试院官网报名系统)
设计目的:
为了在成人高考网络预报名时期快速生成预报名号,绑定手机获得考位,必须先做好报名资料准备。预预报名工具可以事先帮助生成报名时所需要的信息,然后利用填充工具在报名系统上快速填充报名信息,生成预报名号,生成的信息暂保存在EXCEL表格或数据库里——数据库暂未设计,本工具的所有可选择信息均来自官方报名网站。
使用说明:
该程序配备一个”saveANDnext.xlsx”的表格,用以存储预报名系统生成的信息,如图:
填写完考生信息后,点击图中左下角保存并继续报名后,密码、民族、考试语种等均有保留,方便填写下一位学生生成报名信息。
若有信息未填完整,会有弹窗提示,如图:
操作方法:
将小程序和配备的”saveANDnext.xlsx”表格放在同一路径,运行程序,填完信息后点击左下角按钮即可,如图:
这个界面的效果还是比较满意的,尽可能的复现官网报名系统的效果。
界面代码:
这是什么鬼,凌晨1点30分把我写完的文本数据只留下了三分之一,现在在重写剩下的部分。(吐槽一下,我写帖子可是写了两个多小时了)
可能代码里的选择类成考信息有一些是敏感词汇,在这里展示不了,那就在附件下载再看,这里先贴部分代码图:
部分界面代码:
功能代码:
[Python] 纯文本查看 复制代码 def saveANDnext():
#表格存储信息
wb_saveANDnext=openpyxl.load_workbook('saveANDnext.xlsx')
ws_saveANDnext=wb_saveANDnext['saveANDnext']
row_saveANDnext=ws_saveANDnext.max_row+1
#检查
dict_each_data={}
#获取窗口信息并保存
xm=entry_xm.get()#获取姓名
print('姓名:'+xm)
ws_saveANDnext.cell(row_saveANDnext,3).value=xm
dict_each_data['姓名']=xm
try:
if v.get()==1:#获取性别
xbdm='男'
elif v.get()==2:
xbdm='女'
else:
xbdm=''
except:
xbdm=''
print('性别:'+xbdm)
ws_saveANDnext.cell(row_saveANDnext,4).value=xbdm
dict_each_data['性别']=xbdm
pwd=entry_pwd.get()#获取密码
print('密码:'+pwd)
ws_saveANDnext.cell(row_saveANDnext,5).value=pwd
dict_each_data['密码']=pwd
mzdm=cmb_mzdm.get()#获取民族
print('民族:'+mzdm)
ws_saveANDnext.cell(row_saveANDnext,6).value=mzdm
dict_each_data['民族']=mzdm
csrq=entry_csrq.get()#获取出生日期
print('出生日期:'+csrq)
ws_saveANDnext.cell(row_saveANDnext,7).value=csrq
dict_each_data['出生日期']=csrq
zzmmdm=cmb_zzmmdm.get()#获取政治面貌
print('政治面貌:'+zzmmdm)
ws_saveANDnext.cell(row_saveANDnext,8).value=zzmmdm
dict_each_data['政治面貌']=zzmmdm
wyyzdm=cmb_wyyzdm.get()#获取考试语种
print('考试语种:'+wyyzdm)
ws_saveANDnext.cell(row_saveANDnext,9).value=wyyzdm
dict_each_data['考试语种']=wyyzdm
kslxdm=cmb_kslxdm.get()#获取考试类型
print('考试类型:'+kslxdm)
ws_saveANDnext.cell(row_saveANDnext,10).value=kslxdm
dict_each_data['考试类型']=kslxdm
if c.get()==1:#获取照顾加分
zgjf='是'
else:
zgjf='否'
print('照顾加分:'+zgjf)
ws_saveANDnext.cell(row_saveANDnext,11).value=zgjf
kslbdm=cmb_kslbdm.get()#获取考生类别
print('考生类别:'+kslbdm)
ws_saveANDnext.cell(row_saveANDnext,12).value=kslbdm
dict_each_data['考生类别']=kslbdm
jhlbdm=cmb_jhlbdm.get()#获取报考科类
print('报考科类:'+jhlbdm)
ws_saveANDnext.cell(row_saveANDnext,13).value=jhlbdm
dict_each_data['报考科类']=jhlbdm
kmzdm=cmb_kmzdm.get()#获取考试科目组
print('考试科目组:'+kmzdm)
ws_saveANDnext.cell(row_saveANDnext,14).value=kmzdm
dict_each_data['考试科目组']=kmzdm
xqdm=cmb_xqdm.get()#获取考试县区
print('考试县区:'+xqdm)
ws_saveANDnext.cell(row_saveANDnext,15).value=xqdm
dict_each_data['考试县区']=xqdm
bmddm=cmb_bmddm.get()#获取报名点
print('报名点:'+bmddm)
ws_saveANDnext.cell(row_saveANDnext,16).value=bmddm
dict_each_data['报名点']=bmddm
kqxl=cmb_kqxl.get()#获取考前学历
print('考前学历:'+kqxl)
ws_saveANDnext.cell(row_saveANDnext,17).value=kqxl
dict_each_data['考前学历']=kqxl
hkdm=cmb_hkdm.get()#获取户口代码
print('户口代码:'+hkdm)
ws_saveANDnext.cell(row_saveANDnext,18).value=hkdm
dict_each_data['户口代码']=hkdm
zydm=cmb_zydm.get()#获取职业
print('职业:'+zydm)
ws_saveANDnext.cell(row_saveANDnext,19).value=zydm
dict_each_data['职业']=zydm
zjlxdm=cmb_zjlxdm.get()#获取证件类型
print('证件类型:'+zjlxdm)
ws_saveANDnext.cell(row_saveANDnext,20).value=zjlxdm
dict_each_data['证件类型']=zjlxdm
zjdm=entry_zjdm.get()#获取证件号
print('证件号:'+zjdm)
ws_saveANDnext.cell(row_saveANDnext,21).value=zjdm
dict_each_data['证件号']=zjdm
byxx=entry_byxx.get()#获取毕业学校
print('毕业学校:'+byxx)
ws_saveANDnext.cell(row_saveANDnext,22).value=byxx
dict_each_data['毕业学校']=byxx
byrq=entry_byrq.get()#获取毕业日期
print('毕业日期:'+byrq)
ws_saveANDnext.cell(row_saveANDnext,23).value=byrq
dict_each_data['毕业日期']=byrq
byzy=entry_byzy.get()#获取毕业专业
print('毕业专业:'+byzy)
ws_saveANDnext.cell(row_saveANDnext,24).value=byzy
dict_each_data['毕业专业']=byzy
byzshm=entry_byzshm.get()#获取毕业证书号
print('毕业证书号:'+byzshm)
ws_saveANDnext.cell(row_saveANDnext,25).value=byzshm
dict_each_data['毕业证书号']=byzshm
yzbm=entry_yzbm.get()#获取邮政编码
print('邮政编码:'+yzbm)
ws_saveANDnext.cell(row_saveANDnext,26).value=yzbm
dict_each_data['邮政编码']=yzbm
lxdh=entry_lxdh.get()#获取固定电话
print('固定电话:'+lxdh)
ws_saveANDnext.cell(row_saveANDnext,27).value=lxdh
entry_lxdh.delete(0,'end')
lxsj=entry_lxsj.get()#获取移动电话
print('移动电话:'+lxsj)
ws_saveANDnext.cell(row_saveANDnext,28).value=lxsj
dict_each_data['联系电话']=lxsj
txdz=entry_txdz.get()#获取通讯地址
print('通讯地址:'+txdz)
ws_saveANDnext.cell(row_saveANDnext,29).value=txdz
dict_each_data['通讯地址']=txdz
if kslbdm=='专科升本科类':#获取院校和专业
zsbpc1bkyx1=entry_zsbpc1bkyx1.get()
zsbpc1bkyx1zy1=entry_zsbpc1bkyx1zy1.get()
zsbpc1bkyx1zy2=entry_zsbpc1bkyx1zy2.get()
zsbpc1bkyx2=entry_zsbpc1bkyx2.get()
zsbpc1bkyx2zy1=entry_zsbpc1bkyx2zy1.get()
zsbpc1bkyx2zy2=entry_zsbpc1bkyx2zy2.get()
print('专升本院校1:'+zsbpc1bkyx1)
print('院校1专业1:'+zsbpc1bkyx1zy1)
print('院校1专业2:'+zsbpc1bkyx1zy2)
print('专升本院校2:'+zsbpc1bkyx2)
print('院校2专业1:'+zsbpc1bkyx2zy1)
print('院校2专业2:'+zsbpc1bkyx2zy2)
ws_saveANDnext.cell(row_saveANDnext,30).value=zsbpc1bkyx1
ws_saveANDnext.cell(row_saveANDnext,31).value=zsbpc1bkyx1zy1
ws_saveANDnext.cell(row_saveANDnext,32).value=zsbpc1bkyx1zy2
ws_saveANDnext.cell(row_saveANDnext,33).value=zsbpc1bkyx2
ws_saveANDnext.cell(row_saveANDnext,34).value=zsbpc1bkyx2zy1
ws_saveANDnext.cell(row_saveANDnext,35).value=zsbpc1bkyx2zy2
dict_each_data['专升本院校1']=zsbpc1bkyx1
dict_each_data['院校1专业1']=zsbpc1bkyx1zy1
dict_each_data['院校1专业2']=zsbpc1bkyx1zy2
dict_each_data['专升本院校2']=zsbpc1bkyx1
dict_each_data['院校2专业1']=zsbpc1bkyx2zy1
dict_each_data['院校2专业2']=zsbpc1bkyx2zy2
else:
gqgpc4bkyx1=entry_gqgpc4bkyx1.get()
gqgpc4bkyx1zy1=entry_gqgpc4bkyx1zy1.get()
gqgpc4bkyx1zy2=entry_gqgpc4bkyx1zy2.get()
gqgpc4bkyx2=entry_gqgpc4bkyx2.get()
gqgpc4bkyx2zy1=entry_gqgpc4bkyx2zy1.get()
gqgpc4bkyx2zy2=entry_gqgpc4bkyx2zy2.get()
gqgpc4bkyx3=entry_gqgpc4bkyx3.get()
gqgpc4bkyx3zy1=entry_gqgpc4bkyx3zy1.get()
gqgpc4bkyx3zy2=entry_gqgpc4bkyx3zy2.get()
print('高起专院校1:'+gqgpc4bkyx1)
print('院校1专业1:'+gqgpc4bkyx1zy1)
print('院校1专业2:'+gqgpc4bkyx1zy2)
print('高起专院校2:'+gqgpc4bkyx2)
print('院校2专业1:'+gqgpc4bkyx2zy1)
print('院校2专业2:'+gqgpc4bkyx2zy2)
print('高起专院校3:'+gqgpc4bkyx3)
print('院校3专业1:'+gqgpc4bkyx3zy1)
print('院校3专业2:'+gqgpc4bkyx3zy2)
ws_saveANDnext.cell(row_saveANDnext,30).value=gqgpc4bkyx1
ws_saveANDnext.cell(row_saveANDnext,31).value=gqgpc4bkyx1zy1
ws_saveANDnext.cell(row_saveANDnext,32).value=gqgpc4bkyx1zy2
ws_saveANDnext.cell(row_saveANDnext,33).value=gqgpc4bkyx2
ws_saveANDnext.cell(row_saveANDnext,34).value=gqgpc4bkyx2zy1
ws_saveANDnext.cell(row_saveANDnext,35).value=gqgpc4bkyx2zy2
ws_saveANDnext.cell(row_saveANDnext,36).value=gqgpc4bkyx3
ws_saveANDnext.cell(row_saveANDnext,37).value=gqgpc4bkyx3zy1
ws_saveANDnext.cell(row_saveANDnext,38).value=gqgpc4bkyx3zy2
dict_each_data['高起专院校1']=gqgpc4bkyx1
dict_each_data['院校1专业1']=gqgpc4bkyx1zy1
dict_each_data['院校1专业2']=gqgpc4bkyx1zy2
dict_each_data['高起专院校2']=gqgpc4bkyx2
dict_each_data['院校2专业1']=gqgpc4bkyx2zy1
dict_each_data['院校2专业2']=gqgpc4bkyx2zy2
dict_each_data['高起专院校3']=gqgpc4bkyx3
dict_each_data['院校3专业1']=gqgpc4bkyx3zy1
dict_each_data['院校3专业2']=gqgpc4bkyx3zy2
#检查空项
zsbdata=['院校1专业2','专升本院校2','院校2专业1','院校2专业2']
gqgdata=['毕业专业','毕业证书号','院校1专业2','高起专院校2','院校2专业1','院校2专业2','高起专院校3','院校3专业1','院校3专业2']
keyINdata=list(dict_each_data.keys())
for each_key in keyINdata:
live_messagebox=0
if kslbdm=='专科升本科类':
if dict_each_data[each_key]=='' and (each_key in zsbdata)==False:
messagebox.showinfo(title='提示', message=each_key+' 未填')
live_messagebox=1
break
elif kslbdm=='高中起点高职高专':
if dict_each_data[each_key]=='' and (each_key in gqgdata)==False:
messagebox.showinfo(title='提示', message=each_key+' 未填')
live_messagebox=1
break
elif kslbdm=='':
messagebox.showinfo(title='提示', message='请选择考生类别并完整填写其他信息')
live_messagebox=1
break
#信息填写完整保存
if live_messagebox==0:
wb_saveANDnext.save('saveANDnext.xlsx')
entry_xm.delete(0,'end')
radiobutton_male.deselect()
radiobutton_female.deselect()
entry_csrq.delete(0,'end')
cmb_hkdm.delete(0,'end')
entry_zjdm.delete(0,'end')
entry_byxx.delete(0,'end')
entry_byrq.delete(0,'end')
entry_byzy.delete(0,'end')
entry_byzshm.delete(0,'end')
entry_lxsj.delete(0,'end')
entry_zsbpc1bkyx1.delete(0,'end')
entry_zsbpc1bkyx1zy1.delete(0,'end')
entry_zsbpc1bkyx1zy2.delete(0,'end')
entry_zsbpc1bkyx2.delete(0,'end')
entry_zsbpc1bkyx2zy1.delete(0,'end')
entry_zsbpc1bkyx2zy2.delete(0,'end')
entry_gqgpc4bkyx1.delete(0,'end')
entry_gqgpc4bkyx1zy1.delete(0,'end')
entry_gqgpc4bkyx1zy2.delete(0,'end')
entry_gqgpc4bkyx2.delete(0,'end')
entry_gqgpc4bkyx2zy1.delete(0,'end')
entry_gqgpc4bkyx2zy2.delete(0,'end')
entry_gqgpc4bkyx3.delete(0,'end')
entry_gqgpc4bkyx3zy1.delete(0,'end')
entry_gqgpc4bkyx3zy2.delete(0,'end')
print('------------------------------------------')
main.update()
三、报名信息快速填充(报名第二步)
设计目的:
如今成考考位是考生手机绑定才生成考位,但每年考位紧张,迅速填充报名信息生成预报名号,立即绑定手机是重中之重。只要事先准备信息充足无误,便可使用工具快速填充。
使用说明:
由于不能事先知道院校代码和专业代码是否有调整,所以在预报名系统时填写志愿是用院校全称和专业全称。
首先进行院校和专业全称的替换,打开”saveANDnext.xlsx”表格,如图:
我们先将院校和专业全称替换成该年成人高考报名相应代码,如图:
操作方法:运行程序,将信息对应所在行填写进程序里,点击”开始填充”按钮即可。如图:
填充代码:
[Python] 纯文本查看 复制代码 from selenium import webdriver
from pykeyboard import PyKeyboard
import time
import openpyxl
from selenium.webdriver.support.select import Select
import re
import tkinter
import sys
def baoming():
#进入主页
while True:
driver=webdriver.Chrome()
driver.set_page_load_timeout(300)
driver.set_script_timeout(300)
try:
driver.get('https://www.eeagd.edu.cn/cr/cgbm/cgybm.jsp')
time.sleep(2)
k=PyKeyboard()
k.press_key(k.return_key)
time.sleep(2)
break
except:
print('网站30秒无反应,太多人访问了,等会再重新运行吧')
driver.quit()
#打开报名表格
wb=openpyxl.load_workbook('saveANDnext.xlsx')
ws=wb['saveANDnext']
#填写信息
driver.find_element_by_name('xm').send_keys(ws.cell(2,3).value)#填写姓名
if ws.cell(2,4).value=='男':
driver.find_elements_by_name('xbdm')[0].click()#性别男
elif ws.cell(2,4).value=='女':
driver.find_elements_by_name('xbdm')[1].click()#性别女
driver.find_element_by_name('pwd').send_keys(ws.cell(2,5).value)#填写密码
Select(driver.find_element_by_name('mzdm')).select_by_visible_text(ws.cell(2,6).value)#选择民族
Select(driver.find_element_by_name('zzmmdm')).select_by_visible_text(ws.cell(2,8).value)#政治面貌
Select(driver.find_element_by_name('wyyzdm')).select_by_visible_text(ws.cell(2,9).value)#考试语种
Select(driver.find_element_by_name('kslxdm')).select_by_visible_text(ws.cell(2,10).value)#考试类型
Select(driver.find_element_by_name('kslbdm')).select_by_visible_text(ws.cell(2,12).value)#考生类别
Select(driver.find_element_by_name('jhlbdm')).select_by_visible_text(ws.cell(2,13).value)#报考科类
Select(driver.find_element_by_name('kmzdm')).select_by_visible_text(ws.cell(2,14).value)#考试科目组
Select(driver.find_element_by_name('xqdm')).select_by_visible_text(ws.cell(2,15).value)#考试县区
Select(driver.find_element_by_name('bmddm')).select_by_visible_text(ws.cell(2,16).value)#报名点
while True:
time.sleep(0.5)
k.press_key(k.return_key)
try:
Select(driver.find_element_by_name('kqxl')).select_by_visible_text(ws.cell(2,17).value)#考前学历
break
except:
continue
Select(driver.find_element_by_name('hkdm')).select_by_visible_text(ws.cell(2,18).value)#户口所在地
Select(driver.find_element_by_name('zydm')).select_by_visible_text(ws.cell(2,19).value)#职业
Select(driver.find_element_by_name('zjlxdm')).select_by_visible_text(ws.cell(2,20).value)#证件类型
driver.find_element_by_name('byxx').send_keys(ws.cell(2,22).value)#毕业院校
driver.find_element_by_name('byzy').send_keys(ws.cell(2,24).value)#毕业专业
driver.find_element_by_name('byzshm').send_keys(ws.cell(2,25).value)#毕业证书号
while True:
time.sleep(0.5)
k.press_key(k.return_key)
try:
driver.find_element_by_name('yzbm').send_keys(ws.cell(2,26).value)#邮政编码
break
except:
continue
if ws.cell(2,27).value!=None:
driver.find_element_by_name('lxdh').send_keys(ws.cell(2,27).value)#固定电话
driver.find_element_by_name('lxsj').send_keys(ws.cell(2,28).value)#移动电话
driver.find_element_by_name('txdz').send_keys(ws.cell(2,29).value)#通讯地址
try:
if ws.cell(2,12).value=='专科升本科类':
driver.find_element_by_name('zsbpc1bkyx1').send_keys(ws.cell(2,30).value)#院校1
driver.find_element_by_name('zsbpc1bkyx1zy1').send_keys(ws.cell(2,31).value)#院校1专业1
driver.find_element_by_name('zsbpc1bkyx1zy2').send_keys(ws.cell(2,32).value)#院校1专业2
driver.find_element_by_name('zsbpc1bkyx2').send_keys(ws.cell(2,33).value)#院校2
driver.find_element_by_name('zsbpc1bkyx2zy1').send_keys(ws.cell(2,34).value)#院校2专业1
driver.find_element_by_name('zsbpc1bkyx2zy2').send_keys(ws.cell(2,35).value)#院校2专业2
elif ws.cell(2,12).value=='高中起点高职高专':
'''
只填充非脱产志愿
'''
driver.find_element_by_name('gqgpc4bkyx1').send_keys(ws.cell(2,30).value)#院校1
driver.find_element_by_name('gqgpc4bkyx1zy1').send_keys(ws.cell(2,31).value)#院校1专业1
driver.find_element_by_name('gqgpc4bkyx1zy2').send_keys(ws.cell(2,32).value)#院校1专业2
driver.find_element_by_name('gqgpc4bkyx2').send_keys(ws.cell(2,33).value)#院校2
driver.find_element_by_name('gqgpc4bkyx2zy1').send_keys(ws.cell(2,34).value)#院校2专业1
driver.find_element_by_name('gqgpc4bkyx2zy2').send_keys(ws.cell(2,35).value)#院校2专业2
driver.find_element_by_name('gqgpc4bkyx3').send_keys(ws.cell(2,36).value)#院校3
driver.find_element_by_name('gqgpc4bkyx3zy1').send_keys(ws.cell(2,37).value)#院校3专业1
driver.find_element_by_name('gqgpc4bkyx3zy2').send_keys(ws.cell(2,38).value)#院校3专业2
except:
pass
driver.find_element_by_name('csrq').click()#出生日期
time.sleep(1)
for key in re.findall('\\d',ws.cell(2,7).value):
time.sleep(0.2)
k.tap_key(key)
driver.find_element_by_name('zjdm').send_keys(ws.cell(2,21).value)#证件号
driver.find_element_by_name('byrq').click()#毕业年月
time.sleep(1)
for key in re.findall('\\d',ws.cell(2,23).value):
time.sleep(0.2)
k.tap_key(key)
top=tkinter.Tk()
top.title('成人高考报名信息快速填充')
top.geometry('320x80')
label_row=tkinter.Label(top,text='报名信息所在行:')
label_row.grid(row=1,column=0)
entry_row=tkinter.Entry(top,width=30)
entry_row.grid(row=1,column=1)
button_start=tkinter.Button(top,text='开始填充',command=baoming)
button_start.grid(row=2,column=0)
top.mainloop()
四、查询
(1)一个一个复制预报名号就是拖慢我报名时间,上爬虫!
[Python] 纯文本查看 复制代码 import requests
import openpyxl
from bs4 import BeautifulSoup
import time
import re
import sys
import warnings
warnings.filterwarnings('ignore')
wb_ybmh=openpyxl.load_workbook('saveANDnext.xlsx')
ws_ybmh=wb_ybmh['saveANDnext']
for row in range(2,ws_ybmh.max_row+1):#从第2行开始到最后一行
header={'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'}
url='https://www.eeagd.edu.cn/cr/cgbm/zhbmh.jsp'
data={
'xm': bytes(ws_ybmh.cell(row,3).value,encoding='gbk'),
'zjh': ws_ybmh.cell(row,21).value
}
try:
rep=requests.post(url,headers=header,data=data)
except:
ws_ybmh.cell(row,39).value='请重新获取'
time.sleep(1)
continue
#print(rep.text)
soup=BeautifulSoup(rep.text)
ybmh=soup.find_all('font',style="color: red;")[0].text
ybmh=re.sub('\n|\r| ','',ybmh)
print('第'+str(row)+'行'+ws_ybmh.cell(row,3).value+ybmh)
ws_ybmh.cell(row,39).value=ybmh
time.sleep(1)#访问延迟
try:
wb_ybmh.save('saveANDnext.xlsx')
print('保存成功')
except:
print('请关闭表格重新运行程序')
sys.exit()
效果:
(2)那我要检查我的学籍状态,交费了没有,交费了考生号多少怎么办?上爬虫!
[Python] 纯文本查看 复制代码 import requests
import openpyxl
import ddddocr
from bs4 import BeautifulSoup
import re
import warnings
import sys
import time
warnings.filterwarnings('ignore')
wb=openpyxl.load_workbook('saveANDnext.xlsx')
ws=wb.active
for row in range(2,ws.max_row+1):
print('行数:'+str(row)+' 姓名:'+ws.cell(row,3).value)
#获取cookie
header_cookie={'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'}
url_cookie='https://www.eeagd.edu.cn/cr/cgbm/login.jsp'
rep_cookie=requests.get(url_cookie,headers=header_cookie)
cookie='BIGipServercr_student_pool='+requests.utils.dict_from_cookiejar(rep_cookie.cookies)['BIGipServercr_student_pool']+';'+'JSESSIONID='+requests.utils.dict_from_cookiejar(rep_cookie.cookies)['JSESSIONID']
print('获取ookie:'+cookie)
header={
'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',
'Cookie': cookie
}
#获取验证码并翻译
url_code='https://www.eeagd.edu.cn/cr/servlet/VerifyCodeServlet?t=1'
rep_code=requests.get(url_code,headers=header)
with open('code.jpg','wb') as f:
f.write(rep_code.content)
ocr=ddddocr.DdddOcr()
with open('code.jpg','rb') as f:
code_bytes=f.read()
code=ocr.classification(code_bytes)
print('识别验证码:'+code)
#登录
s=requests.session()
url_login='https://www.eeagd.edu.cn/cr/cgbm/login.do'
data_login={
'dlfs': '1',
'id': re.sub('。|报名号:','',ws.cell(row,39).value),
'ksh': '',
'pwd': 'YTY2NjY2NjY=',
'verifyCodeImg': code
}
rep_login=s.post(url_login,headers=header,data=data_login)
print('登录状态:'+rep_login.text)
if rep_login.text=='success':
#获取信息
url_ybcg='https://www.eeagd.edu.cn/cr/cgbm/ybcg.jsp'
data_ybcg={
'dlfs': '1',
'id': re.sub('。|报名号:','',ws.cell(row,39).value),
'ksh': '',
'pwd': 'YTY2NjY2NjY=',
'verifyCodeImg': code
}
rep_ybcg=s.post(url_ybcg,headers=header,data=data_ybcg)
#print(rep_ybcg.text)
#获取身份证
soup_ybcg=BeautifulSoup(rep_ybcg.text)
for each1_basedata in soup_ybcg.find_all('tbody',style='background-color: #D1EEEE;'):
for each2_basedata in each1_basedata:
# if '证件号' in str(each2_basedata):
# zhengjianhao=(each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.text+each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.text)
# ws.cell(row,6).value=zhengjianhao
# print('获取 证件号 成功')
if '高中学籍检查' in str(each2_basedata) or '证书检查状态' in str(each2_basedata):
xueji=(each2_basedata.td.text+each2_basedata.td.next_sibling.next_sibling.text)
ws.cell(row,40).value=xueji
print('获取 高中学籍检查or证书检查状态 成功')
if '交费情况' in str(each2_basedata):
jiaofei=(each2_basedata.td.text+each2_basedata.td.next_sibling.next_sibling.text)
caiji=(each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.text+each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.text)
ws.cell(row,41).value=jiaofei
ws.cell(row,42).value=caiji
print('获取 交费情况 成功')
print('获取 相片采集 成功')
if '相片审核状态' in str(each2_basedata):
xiangpianshenhe=(each2_basedata.td.text+each2_basedata.td.next_sibling.next_sibling.text)
shenheyijian=(each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.text+each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.text)
ws.cell(row,43).value=xiangpianshenhe
ws.cell(row,44).value=shenheyijian
print('获取 相片审核状态 成功')
print('获取 相片审核意见 成功')
#判断层次类别
kslb=soup_ybcg.find_all('input',id='kslbdm')[0].next_sibling.next_sibling.text
# print(kslb)
if '专科升本科类' in str(kslb):
ws.cell(row,7).value='专科升本科类'
print('获取 层次 成功')
zsb=soup_ybcg.find_all('tbody',id='zsb')[0]
for each_td in zsb.find_all('td'):
try:
if '院校1' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校1'+zy1+' 成功')
print('获取 院校1'+zy2+' 成功')
ws.cell(row,45).value=yx
ws.cell(row,46).value=zy1
ws.cell(row,47).value=zy2
if '院校2' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校2'+zy1+' 成功')
print('获取 院校2'+zy2+' 成功')
ws.cell(row,48).value=yx
ws.cell(row,49).value=zy1
ws.cell(row,50).value=zy2
except:
print('志愿获取失败')
pass
elif '高中起点高职高专' in str(kslb):
ws.cell(row,7).value='高中起点高职高专'
print('获取 层次 成功')
gqg=soup_ybcg.find_all('tbody',id='gqg')[0]
for each_td in gqg.find_all('td'):
try:
if '院校1' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校1'+zy1+' 成功')
print('获取 院校1'+zy2+' 成功')
ws.cell(row,45).value=yx
ws.cell(row,46).value=zy1
ws.cell(row,47).value=zy2
if '院校2' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校2'+zy1+' 成功')
print('获取 院校2'+zy2+' 成功')
ws.cell(row,48).value=yx
ws.cell(row,49).value=zy1
ws.cell(row,50).value=zy2
if '院校3' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校3'+zy1+' 成功')
print('获取 院校3'+zy2+' 成功')
ws.cell(row,51).value=yx
ws.cell(row,52).value=zy1
ws.cell(row,53).value=zy2
except:
print('志愿获取失败')
pass
print('--------------------------------------')
time.sleep(1)
elif rep_login.text=='confirm':
#获取信息
url_ybcg='https://www.eeagd.edu.cn/cr/cgbm/qrcg.jsp'
data_ybcg={
'dlfs': '1',
'id': ws.cell(row,3).value,
'ksh': '',
'pwd': 'YTY2NjY2NjY=',
'verifyCodeImg': code
}
rep_ybcg=s.post(url_ybcg,headers=header,data=data_ybcg)
#print(rep_ybcg.text)
#获取考生号
soup_ybcg=BeautifulSoup(rep_ybcg.text)
for ksh in soup_ybcg.find_all('font',color='red'):
if len(ksh.text)==9:
ws.cell(row,54).value=ksh.text
print('考生号:'+ksh.text+' 获取成功')
for each1_basedata in soup_ybcg.find_all('tbody',style='background-color: #D1EEEE;'):
for each2_basedata in each1_basedata:
# if '证件号' in str(each2_basedata):
# zhengjianhao=(each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.text+each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.text)
# ws.cell(row,6).value=zhengjianhao
# print('获取 证件号 成功')
if '高中学籍检查' in str(each2_basedata) or '证书检查状态' in str(each2_basedata):
xueji=(each2_basedata.td.text+each2_basedata.td.next_sibling.next_sibling.text)
ws.cell(row,40).value=xueji
print('获取 高中学籍检查or证书检查状态 成功')
if '交费情况' in str(each2_basedata):
jiaofei=(each2_basedata.td.text+each2_basedata.td.next_sibling.next_sibling.text)
caiji=(each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.text+each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.text)
ws.cell(row,41).value=jiaofei
ws.cell(row,42).value=caiji
print('获取 交费情况 成功')
print('获取 相片采集 成功')
if '相片审核状态' in str(each2_basedata):
xiangpianshenhe=(each2_basedata.td.text+each2_basedata.td.next_sibling.next_sibling.text)
shenheyijian=(each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.text+each2_basedata.td.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.next_sibling.text)
ws.cell(row,43).value=xiangpianshenhe
ws.cell(row,44).value=shenheyijian
print('获取 相片审核状态 成功')
print('获取 相片审核意见 成功')
#判断层次类别
kslb=soup_ybcg.find_all('input',id='kslbdm')[0].next_sibling.next_sibling.text
# print(kslb)
if '专科升本科类' in str(kslb):
ws.cell(row,7).value='专科升本科类'
print('获取 层次 成功')
zsb=soup_ybcg.find_all('tbody',id='zsb')[0]
for each_td in zsb.find_all('td'):
try:
if '院校1' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校1'+zy1+' 成功')
print('获取 院校1'+zy2+' 成功')
ws.cell(row,45).value=yx
ws.cell(row,46).value=zy1
ws.cell(row,47).value=zy2
if '院校2' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校2'+zy1+' 成功')
print('获取 院校2'+zy2+' 成功')
ws.cell(row,48).value=yx
ws.cell(row,49).value=zy1
ws.cell(row,50).value=zy2
except:
pass
elif '高中起点高职高专' in str(kslb):
ws.cell(row,7).value='高中起点高职高专'
print('获取 层次 成功')
gqg=soup_ybcg.find_all('tbody',id='gqg')[0]
for each_td in gqg.find_all('td'):
try:
if '院校1' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校1'+zy1+' 成功')
print('获取 院校1'+zy2+' 成功')
ws.cell(row,45).value=yx
ws.cell(row,46).value=zy1
ws.cell(row,47).value=zy2
if '院校2' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校2'+zy1+' 成功')
print('获取 院校2'+zy2+' 成功')
ws.cell(row,48).value=yx
ws.cell(row,49).value=zy1
ws.cell(row,50).value=zy2
if '院校3' in each_td.text:
yx=re.findall('(院校.*)\r',each_td.text)[0]
zy1=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.text)[0]
try:
zy2=re.findall('(专业.*)\r',each_td.next_sibling.next_sibling.next_sibling.next_sibling.text)[0]
except:
zy2=''
print('获取 '+yx+' 成功')
print('获取 院校3'+zy1+' 成功')
print('获取 院校3'+zy2+' 成功')
ws.cell(row,51).value=yx
ws.cell(row,52).value=zy1
ws.cell(row,53).value=zy2
except:
pass
print('--------------------------------------')
time.sleep(1)
else:
print('登录失败,请重试')
ws.cell(row,6).value='登录失败,请重试'
print('--------------------------------------')
continue
try:
wb.save('saveANDnext.xlsx')
print('保存成功')
except:
print('请关闭表格重新运行')
sys.exit()
效果:
五、用于保存信息的表格展示
无论是信息录入、报名中、报名后查询的信息均保存在同一表格,所以解一下:
A~M列(1-13列):序号,分教点地市,姓名,性别,密码,民族,出生日期,政治面貌,考试语种,考试类型,照顾加分,考生类别,报考科类
N~S列(14-18列):考试科目组,考试县区,报名点,考前学历,户口所在地,职业
S~Y列(19-25列):职业,证件类型,证件号,毕业学校,毕业年月,毕业专业,毕业证书号
Z~AL列(26-38列):邮政编码,固定电话,联系电话,通讯地址,院校1,专业1,专业2,院校2,专业1,专业2,院校3,专业1,专业2
AM~AR列(39-44列)查询类:CX预报名号,CX学籍检查,CX交费情况,CX相片采集情况,CX相片审核情况,CX相片审核意见
AS~BB列(45-54列)查询类:CX报考院校1,CX院校1专业1,CX院校1专业2,CX报考院校2,CX院校2专业1,CX院校2专业2,CX报考院校3,CX院校3专业1,CX院校3专业2,CX考生号
六、最后说一下
因为报名前系统只有一天的开放测试时间,所以很匆忙的写了几个selenium和requests两种方法来协助报名,最后只选择使用selenium是因为大部分学生信息不完整,填充完报名信息还要检查一遍。
最后写完这个帖子已经是凌晨2.30分了,大家写比较长的帖子前最好先备份一份到word吧。 |
-
-
你的包裹.zip
112.56 KB, 下载次数: 92, 下载积分: 吾爱币 -1 CB
免费评分
-
查看全部评分
|