宪法课堂一键签到脚本 – Python版

2019年11月1日 441 次阅读 0 条评论

起因

高校下发任务,由于小程序bug,操作巨麻烦,视频又多,打卡不方便。为了更好的给学校增加打卡人数(造福偷懒),遂写脚本一个自动化完成,坐等一分钟即可打卡120个视频任务。

Python源码

python
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import requests

'''使用说明'''
# 电脑登录 http://static.qspfw.com/xf2019/index.html
# 第一步,右键,选择检查,右侧选中 network,此时刷新网页,点击右侧,点击XHR,按下CTRL+C,输入 TGT.*?; 并回车。
# 第二步,在右侧 cookie 中,复制 access_token 等号后面到第一个分号中间的内容,替换Python中的 mytoken
# 第三步,运行,坐等 1 分钟

mytoken = "TGT-715849-9zdfPEw94rH7dL1VkP3N2CsCf2avNMsrmPOu0ozTxmOfGypEr-cas.qspfw.com"


obj = ['97045018652462261'
,'97045018652462262'
,'97045018652462263'
,'97045018652462264'
,'97045018652462265'
,'97045018652462266'
,'97045018652462267'
,'97045018652462268'
,'97045018652462269'
,'97045018652462270'
,'97045018652462271'
,'97045018652462272'
,'97045018652462273'
,'97045018652462274'
,'97045018652462275'
,'97045018652462276'
,'97045018652462277'
,'97045018652462278'
,'97045018652462279'
,'97045018652462280'
,'97045018652462281'
,'97045018652462282'
,'97045018652462283'
,'97045018652462284'
,'97045018652462285'
,'97045018652462286'
,'97045018652462287'
,'97045018652462288'
,'97045018652462289'
,'97045018652462290'
,'97045018652462291'
,'97045018652462292'
,'97045018652462293'
,'97045018652462294'
,'97045018652462295'
,'97045018652462296'
,'97045018652462297'
,'97045018652462298'
,'97045018652462299'
,'97045018652462300'
,'97045018652462301'
,'97045018652462302'
,'97045018652462303'
,'97045018652462304'
,'97045018652462305'
,'97045018652462306'
,'97045018652462307'
,'97045018652462308'
,'97045018652462309'
,'97045018652462310'
,'97045018652462311'
,'97045018652462312'
,'97045018652462313'
,'97045018652462314'
,'97045018652462315'
,'97045018652462316'
,'97045018652462317'
,'97045018652462318'
,'97045018652462319'
,'97045018652462320'
,'97045018652462321'
,'97045018652462322'
,'97045018652462323'
,'97045018652462324'
,'97045018652462325'
,'97045018652462326'
,'97045018652462327'
,'97045018652462328'
,'97045018652462329'
,'97045018652462330'
,'97045018652462331'
,'97045018652462332'
,'97045018652462333'
,'97045018652462334'
,'97045018652462335'
,'97045018652462336'
,'97045018652462337'
,'97045018652462338'
,'97045018652462339'
,'97045018652462340'
,'97045018652462341'
,'97045018652462342'
,'97045018652462343'
,'97045018652462344'
,'97045018652462345'
,'97045018652462346'
,'97045018652462347'
,'97045018652462348'
,'97045018652462349'
,'97045018652462350'
,'97045018652462351'
,'97045018652462352'
,'97045018652462353'
,'97045018652462354'
,'97045018652462355'
,'97045018652462356'
,'97045018652462357'
,'97045018652462358'
,'97045018652462359'
,'97045018652462360'
,'97045018652462361'
,'97045018652462362'
,'97045018652462363'
,'97045018652462364'
,'97045018652462365'
,'97045018652462366'
,'97045018652462367'
,'97045018652462368'
,'97045018652462369'
,'97045018652462370'
,'97045018652462371'
,'97045018652462372'
,'97045018652462373'
,'97045018652462374'
,'97045018652462375'
,'97045018652462376'
,'97045018652462377'
,'97045018652462378'
,'97045018652462379'
,'97045018652462380'
,'97045018652462381']


api_url = "https://test.qspfw.com/exam-punch/punch/record/punch"

data_form = {
    "activityId":"1",
    "activityType":"1",
    "knowledgeId":"",
    "knowledgeName":"1"
}


myheaders = {
"Accept": "*/*",
"access-token":mytoken,
"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",
"Origin":"http://static.qspfw.com",
"source":"WEB",
"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/73.0.3683.86 Mobile Safari/537.36"
}



for item in obj:
    data_form["knowledgeId"] = item
    req = requests.post(api_url,headers=myheaders,data=data_form)
    req2 = requests.get("https://test.qspfw.com/user_service/portalApi/studyPaperList?batchId=19&type=1&paperPhase=0&paperId="+item,headers=myheaders)
    print(req.text)

根据源码上的提示,很简单,登录后把程序上的access-token替换成你的,就可以开箱即用了。

文章评论(0)

我来讲两句~