自动化滇医通

###我已经将数据爬取出来###
现在开源集合大家的思路一起研究
(请更换ip 以及 暂停时间 不然会提示违规操作)
脚本读取预约信息后开始随机抢一家的,qiang方法里面请自行修改抓包数据参数!!
在这里插入图片描述
现在开源大家一起讨论

python代码:

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import requests
import random
import json
import time
# 抓包信息填入
from_date="2021-09-07"#今日日期 请注意格式
end_date="2021-09-14"#14
reg_data="2017-2-20"
Authorization="DYT eyJhbGciOiJIUzI1NiJ9.eyJ3ZWNoYXRfaWQiOjQyMDM5NTUsInN1YnNjcmliZSI6MCwiZHpqX3N1YnNjcmliZSI6MCwib3BlbmlkIjoib19VMzZzNE0yclR0M0NZbG5Zb05jZnZ3UnIwWSIsInRoaXJkX3VzZXJfaWQiOiIiLCJpc3MiOiJkeXQiLCJuZXdfc3Vic2NyaWJlIjowLCJuZXdfb3BlbmlkIjoiIiwiZHpqX29wZW5pZCI6IiIsInVzZXJfaWQiOjI4ODg1MTUsIndlY2hhdF9vcGVuX2lkIjoib19VMzZzNE0yclR0M0NZbG5Zb05jZnZ3UnIwWSIsInVuaW9uX2lkIjoib05RejQwWHpPVkRMdW1acmpBTDZEd1M3NUpCQSIsIm1vY2tfb3BlbmlkIjpmYWxzZSwibWluaV9vcGVuaWQiOiJvaUE0UDVFcnFIdFpFeW5MdjVjbjJTSWRhVlpJIiwiZXhwIjoxNjMxMDI2NDIwLCJpYXQiOjE2MzEwMjA4MjB9.d_wdcEKoUY6yXFPdkZpqk_LbA8pnVuTAS7VP3siM36g"
x_uuid="058F41FDBC3F09683D4E3A96505A4BA8"
acw_tc="0bdd34c216310199867268852e01a12d34c1660f204dfaa7363155fb5343ed"
def dlogin():host = "https://newdytapi.ynhdkc.com/index/hospital/871958/depart"#其他医院请更改871958  华山871958params = {}headers = {"Host": "newdytapi.ynhdkc.com",'Connection': 'keep-alive',"Accept": "application/json, text/plain, */*","User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat",# "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8","Authorization": Authorization,"x-uuid": x_uuid,"Origin": "https://appv2.ynhdkc.com","X-Requested-With": "com.tencent.mm","Sec-Fetch-Site": "same-site","Sec-Fetch-Mode": "cors","Sec-Fetch-Dest": "empty","Referer": "https://appv2.ynhdkc.com/","Accept-Encoding": "gzip, deflate","Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"}cookies = {"acw_tc": acw_tc}r = requests.get(host, data=params)print("函数dlogn\n",r.json())# debug = r.json()code = r.json()['data']['dep_list'][0]msg = r.json()['code']if msg != 1:print("获取不到信息请检查接口")else:# print(code)print("======继续执行!!!======")tmp_dep_id = str(code['dep_id'])print("以获取===dep_id===hos_code")global dep_id,hos_codedep_id = code['dep_id']hos_code=code['hos_code']tmp_dep_name = str(code['dep_name'])tmp_hos_code = str(code['hos_code'])print("dep_id:", tmp_dep_id)print("dep_name:", tmp_dep_name)print("hos_code:", tmp_hos_code)print("======开始监控疫苗开抢状态======")dier(tmp_dep_id,tmp_dep_name,tmp_hos_code)# 变量存入
def dier(tmp_dep_id,tmp_dep_name,tmp_hos_code):host = "https://newdytapi.ynhdkc.com/index/doctor?hos_code="+tmp_hos_code+"&dep_id="+tmp_dep_id+"&from_date="+from_date+"&end_date="+end_date+"&reg_date="+reg_data+"&other_info=undefined&vip=0"# 其他医院请更改871958  华山871958params = {}headers = {"Host": "newdytapi.ynhdkc.com",'Connection': 'keep-alive',"Accept": "application/json, text/plain, */*","User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Content-Type": "application/x-www-form-urlencoded;charset=UTF-8","Authorization": Authorization,"x-uuid": x_uuid,"Origin": "https://appv2.ynhdkc.com","X-Requested-With": "com.tencent.mm","Sec-Fetch-Site": "same-site","Sec-Fetch-Mode": "cors","Sec-Fetch-Dest": "empty","Referer": "https://appv2.ynhdkc.com/","Accept-Encoding": "gzip, deflate","Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"}cookies = {"acw_tc": acw_tc}print(host)r = requests.get(host, data=params, headers=headers, cookies=cookies)debug = r.json()['data'][5]# 2为重组 5为九价其他请自行抓包print("========================",debug)print("存入全局:======")print("doc_id",debug['doc_id'])global doc_iddoc_id = debug['doc_id']print("doc_id存入全局:======")print("hospital_id",debug['hospital_id'])print("doc_name",debug['doc_name'])print("doc_id",debug['doc_id'])print("hos_id",debug['hos_id'])print("sch_date", debug['sch_date'])if r.json()['code']==1:print("获取信息成功!下一步获取预约人信息")tmp_hos_id=str(debug['hos_id'])yuyue(tmp_hos_id)else:print("失败!!!")def cunhuo(tttt):tmo=str(tttt)print("接收到传参数据",tmo)host = "https://newdytapi.ynhdkc.com/index/patient/2807231?hos_id="+tmo# 其他医院请更改871958  华山871958params = {}headers = {"Host": "newdytapi.ynhdkc.com",'Connection': 'keep-alive',"Accept": "application/json, text/plain, */*","User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Content-Type": "application/x-www-form-urlencoded;charset=UTF-8","Authorization": Authorization,"x-uuid": x_uuid,"Origin": "https://appv2.ynhdkc.com","X-Requested-With": "com.tencent.mm","Sec-Fetch-Site": "same-site","Sec-Fetch-Mode": "cors","Sec-Fetch-Dest": "empty","Referer": "https://appv2.ynhdkc.com/","Accept-Encoding": "gzip, deflate","Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"}cookies = {"acw_tc": acw_tc}print(host)r = requests.get(host, data=params, headers=headers, cookies=cookies)zate = r.json()['msg']print(zate)def yuyue(hos_id):tmo=str(hos_id)print("接收到传参数据",tmo)host = "https://newdytapi.ynhdkc.com/index/patient/2807231?hos_id="+tmo# 其他医院请更改871958  华山871958params = {}headers = {"Host": "newdytapi.ynhdkc.com",'Connection': 'keep-alive',"Accept": "application/json, text/plain, */*","User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Content-Type": "application/x-www-form-urlencoded;charset=UTF-8","Authorization": Authorization,"x-uuid": x_uuid,"Origin": "https://appv2.ynhdkc.com","X-Requested-With": "com.tencent.mm","Sec-Fetch-Site": "same-site","Sec-Fetch-Mode": "cors","Sec-Fetch-Dest": "empty","Referer": "https://appv2.ynhdkc.com/","Accept-Encoding": "gzip, deflate","Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"}cookies = {"acw_tc": acw_tc}print(host)r = requests.get(host, data=params, headers=headers, cookies=cookies)zate = r.json()['msg']print(zate)gguide=r.json()['data'][0]print("pat_id",gguide['pat_id'])print("user_id",gguide['user_id'])print("=====存入全局====")global user_id, pat_iduser_id = gguide['user_id']pat_id =  gguide['pat_id']print("=====存入全局====")print("预约人姓名",gguide['patient_name'])print("开始获取疫苗今日信息")yimiao_data()
def yimiao_data():print("======正在抢====")hos_cede_tt=str(hos_code)dep_id_tt = str(dep_id)doc_id_tt = str(doc_id)pat_id_tt = str(pat_id)user_id_tt = str(user_id)# print("hos_code", hos_cede_tt)# print("dep_id", dep_id_tt)# print("doc_id", doc_id_tt)# print("pat_id", pat_id_tt)# print("user_id", user_id_tt)print("数据预览")# 需要xxuid cookiehost = "https://newdytapi.ynhdkc.com/index/schedule?hos_code="+hos_cede_tt+"&dep_id="+dep_id_tt+"&doc_id="+doc_id_tt+"&from_date="+from_date+"&end_date="+end_date+"&reg_date="+reg_data+"&hyid=&vip=0"params = {}headers = {"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8","Host": "newdytapi.ynhdkc.com","User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat","Accept": "application/json, text/plain, */*","Authorization": Authorization,"x-uuid": x_uuid,"Origin": "https://appv2.ynhdkc.com","X-Requested-With": "com.tencent.mm","Sec-Fetch-Site": "same-site","Sec-Fetch-Mode": "cors","Sec-Fetch-Dest": "empty","Referer": "https://appv2.ynhdkc.com/","Accept-Encoding": "gzip, deflate","Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7"}cookies = {"acw_tc": acw_tc}print(host)r = requests.get(host, data=params, headers=headers, cookies=cookies)code = r.json()['data']# 昆明市妇幼保健院(华山西路院区 疫苗)print("当前所选择医院疫苗剩余:")# print(code)a = 0for sch_date1 in code:if sch_date1['src_num'] > 0:print("可以抢_次数+1")a=a+1else:print("不可以抢")print("总可抢数据次数:",a)sjs = random.randint(0, a)print("随机数",sjs)code1 = r.json()['data']aa = 0for sch_date in code1:aa=aa+1print("日期:", sch_date['sch_date'], "剩余预约数量:", sch_date['src_num'])if aa==sjs:print("可以抢")# print("schedule_id",sch_date['schedule_id'])# print("sch_date",sch_date['sch_date'])# print("time_type", sch_date['time_type'])tmp_1 = sch_date['schedule_id']tmp_2 = sch_date['sch_date']tmp_3 = sch_date['time_type']qiang(tmp_1, tmp_2, tmp_3)#     跳转到抢 疫苗的qiang函数else:print("不可以抢")def qiang(schedule_id,sch_date,time_type):print("======正在抢疫苗====")hos_code_q=str(hos_code)dep_id_q = str(dep_id)doc_id_q = str(doc_id)pat_id_q = str(pat_id)user_id_q = str(user_id)schedule_id_q = str(schedule_id)sch_date_q = str(sch_date)# sch_date_q=datetime.date(sch_date_q)print(sch_date_q)# sch_date_q = datetime.datetime.strptime(sch_date_q, '%Y-%m-%d').date()time_type_q = str(time_type)url = "https://dytapi.ynhdkc.com/v1/appoint?hos_code="+hos_code_q+"&dep_id="+dep_id_q+"&doc_id="+doc_id_q+"&pat_id="+pat_id_q+"&user_id="+user_id_q+"&schedule_id="+schedule_id_q+"&cate_name="body = {"doc_name": "重组带状疱疹疫苗(CHO细胞)","hos_name": "昆明市妇幼保健院(华山西路院区 疫苗)","hos_code": "871958","dep_name": "疫苗接种预约","level_name": "","dep_id": dep_id_q,"doc_id": doc_id_q,"pat_id": pat_id_q,"schedule_id": schedule_id_q,"jz_card": "","sch_date": sch_date_q,"time_type": time_type_q,"info": "","ghf": 0,"zlf": 0,"zjf": 0,"jz_start_time": 0,"amt": 0,"jz_card_type": 0,"wechat_login": "dytminiapp"}headers = {'Host':'dytapi.ynhdkc.com','Connection': 'keep-alive','Content-Length': '415','Accept': 'application/json, text/plain, */*','x-uuid': x_uuid,'Content-Type': 'application/json;charset=UTF-8','Origin': 'https://appv2.ynhdkc.com','X-Requested-With': 'com.tencent.mm','Sec-Fetch-Site': 'same-site',# 'User-Agent':'Mozilla/5.0 (Linux; Android 9; V1814T Build/PKQ1.180819.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3117 MMWEBSDK/20210601 Mobile Safari/537.36 MMWEBID/9644 MicroMessenger/8.0.11.1980(0x28000B3B) Process/appbrand0 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram','Sec-Fetch-Mode': 'cors','Sec-Fetch-Dest': 'empty','Referer': 'https://appv2.ynhdkc.com/','Accept-Encoding': 'gzip, deflate',"Authorization": Authorization,"acw_tc": acw_tc,'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7'}
#cookies可以携带在headerprint(url)# data = json.dumps(body)print("数据压缩")# print(data)response = requests.post(url, json=body, headers=headers)# 也可以直接将data字段换成json字段,2.4.3版本之后支持# response  = requests.post(url, json = body, headers = headers)# 返回信息print (response.text)# 返回响应头print (response.status_code)def timer(n):while True:cunhuo(871958)  # 获取用户信time.sleep(n)if __name__ == '__main__':dlogin()# timer(10)  # 存活# print("dep_id:", dep_id)# print("doc_id:", doc_id)# print("pat_id:", pat_id)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/318810.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

3.【Orangepi Zero2】超声模块ultrasonic(HC-SR04)

超声模块ultrasonic(HC-SR04) HC-SR04 超声波距离传感器如何工作?程序实现初始化超声波启动超声波获取距离整合代码 HC-SR04 超声波距离传感器如何工作? 当Trig引脚设置为高电平达 10s 时,超声波距离传感器开始工作。…

Java进阶-Java Stream API详解与使用

本文全面介绍了 Java Stream API 的概念、功能以及如何在 Java 中有效地使用它进行集合和数据流的处理。通过详细解释和示例,文章展示了 Java Stream API 在简化代码、提高效率以及支持函数式编程方面的优势。文中还比较了 Java Stream API 与其他集合处理库的异同&…

通过符号程序搜索提升prompt工程

原文地址:supercharging-prompt-engineering-via-symbolic-program-search 通过自动探索​​大量提示变体来找到更好的提示 2024 年 4 月 22 日 众所周知,LLMs的成功在很大程度上仍然取决于我们用正确的指导和例子来提示他们的能力。随着新一代LLMs变得越…

微信小程序demo-----制作文章专栏

前言:不管我们要做什么种类的小程序都涉及到宣传或者扩展其他业务,我们就可以制作一个文章专栏的页面,实现点击一个专栏跳转到相应的页面,页面可以有科普类的知识或者其他,然后页面下方可以自由发挥,添加联…

【Android学习】简易计算器的实现

1.项目基础目录 新增dimens.xml 用于控制全部按钮的尺寸。图片资源放在drawable中。 另外 themes.xml中原来的 <style name"Theme.Learn" parent"Theme.MaterialComponents.DayNight.DarkActionBar">变为了&#xff0c;加上后可针对button中增加图片…

禄得可转债自定义因子交易系统,年化40%,最大回撤15%

经过2个月的研究&#xff0c;和大佬们讨论轮动算法&#xff0c;选股算法&#xff0c;终于完成了可转债自定义因子轮动系统&#xff0c;非常感谢禄得老师的数据 文件链接 禄得可转债自定义因子交易系统&#xff0c;年化40%,最大回撤15% (qq.com) 网页 https://lude.cc/ 程序支…

【云原生】Docker 实践(四):使用 Dockerfile 文件的综合案例

【Docker 实践】系列共包含以下几篇文章&#xff1a; Docker 实践&#xff08;一&#xff09;&#xff1a;在 Docker 中部署第一个应用Docker 实践&#xff08;二&#xff09;&#xff1a;什么是 Docker 的镜像Docker 实践&#xff08;三&#xff09;&#xff1a;使用 Dockerf…

【简单介绍下Faiss原理和使用】

&#x1f3a5;博主&#xff1a;程序员不想YY啊 &#x1f4ab;CSDN优质创作者&#xff0c;CSDN实力新星&#xff0c;CSDN博客专家 &#x1f917;点赞&#x1f388;收藏⭐再看&#x1f4ab;养成习惯 ✨希望本文对您有所裨益&#xff0c;如有不足之处&#xff0c;欢迎在评论区提出…

Xamarin.Android项目使用ConstraintLayout约束布局

Xamarin.AndroidX.ConstraintLayout Xamarin.Android.Support.Constraint.Layout Xamarin.AndroidX.ConstraintLayout.Solver Xamarin.AndroidX.DataBinding.ViewBinding Xamarin.AndroidX.Legacy.Support.Core.UI Xamarin.AndroidX.Lifecycle.LiveData ![在这里插入图片描述]…

封装umi-request时通过 AbortController 配置取消请求

一、关键部分 一、在封装的request.ts中 声明一个 abortControllers 对象用于存储要取消的请求&#xff08;我用了-s表示复数&#xff0c;多个abortcontroller对象&#xff0c;与下面&#x1f447;的单个abortController区分&#xff09;封装取消请求的函数cancelRequest, 传入…

机器学习:深入解析SVM的核心概念【一、间隔与支持向量】

直接阅读原始论文可能有点难和复杂&#xff0c;所以导师直接推荐我阅读周志华的《西瓜书》&#xff01;&#xff01;然后仔细阅读其中的第六章&#xff1a;支持向量机 间隔与支持向量 **问题一&#xff1a;什么叫法向量&#xff1f;为什么是叫法向量**什么是法向量&#xff1f;…

.NET操作 Access (MSAccess)

注意&#xff1a;新项目推荐 Sqlite &#xff0c;Access需要注意的东西太多了&#xff0c;比如OFFICE版本&#xff0c;是X86还是X64 连接字符串 ProviderMicrosoft.ACE.OleDB.15.0;Data Source"GetCurrentProjectPath"\\test.accdb//不同的office版本 连接字符串有…

【Transformer系列(4)】基于vision transformer(ViT)实现猫狗二分类项目实战

文章目录 一、vision transformer&#xff08;ViT&#xff09;结构解释二、Patch Embedding部分2.1 图像Patch化2.2 cls token2.3 位置编码&#xff08;positional embedding&#xff09; 三、Transformer Encoder部分(1) Multi-head Self-Attention(2) encoder block 四、head…

小程序账号设置以及request请求的封装

一般开发在小程序时&#xff0c;都会有测试版和正式版&#xff0c;这样在开发时会比较方便。 在开发时。产品经理都会给到测试账号和正式账号&#xff0c;后端给的接口也都会有测试环境用到的接口和正式环境用到的接口。 这里讲一讲我这边如何去做的。 1.在更目录随便命名一…

langchain+qwen1.5-7b-chat搭建本地RAG系统

概念 检索增强生成(Retrieval Augmented Generation, RAG)是一种结合语言模型和信息检索的技术,用于生成更准确且与上下文相关的输出。 通用模型遇到的问题,也是RAG所擅长的: 知识的局限性: RAG 通过从知识库、数据库、企业内部数据等外部数据源中检索相关信息,将其注…

物联网实战--平台篇之(二)基础搭建

目录 一、Qt工程创建 二、数据库知识 三、通信协议 四、名词定义 本项目的交流QQ群:701889554 物联网实战--入门篇https://blog.csdn.net/ypp240124016/category_12609773.html 物联网实战--驱动篇https://blog.csdn.net/ypp240124016/category_12631333.html 一、Qt工程…

nginx--压缩https证书favicon.iconginx隐藏版本号 去掉nginxopenSSL

压缩功能 简介 Nginx⽀持对指定类型的⽂件进行压缩然后再传输给客户端&#xff0c;而且压缩还可以设置压缩比例&#xff0c;压缩后的文件大小将比源文件显著变小&#xff0c;这样有助于降低出口带宽的利用率&#xff0c;降低企业的IT支出&#xff0c;不过会占用相应的CPU资源…

VTK —— 二、教程六 - 为模型加入3D微件(按下i键隐藏或显示)(附完整源码)

代码效果 本代码编译运行均在如下链接文章生成的库执行成功&#xff0c;若无VTK库则请先参考如下链接编译vtk源码&#xff1a; VTK —— 一、Windows10下编译VTK源码&#xff0c;并用Vs2017代码测试&#xff08;附编译流程、附编译好的库、vtk测试源码&#xff09; 教程描述 本…

运维笔记:基于阿里云跨地域服务器通信(上)

运维笔记 阿里云&#xff1a;跨地域服务器通信&#xff08;上&#xff09; - 文章信息 - Author: 李俊才 (jcLee95) Visit me at CSDN: https://jclee95.blog.csdn.netMy WebSite&#xff1a;http://thispage.tech/Email: 291148484163.com. Shenzhen ChinaAddress of this a…

算法打卡day40

今日任务&#xff1a; 1&#xff09;139.单词拆分 2&#xff09;多重背包理论基础&#xff08;卡码网56携带矿石资源&#xff09; 3&#xff09;背包问题总结 4&#xff09;复习day15 139单词拆分 题目链接&#xff1a;139. 单词拆分 - 力扣&#xff08;LeetCode&#xff09; …