bear-zd / ChaoXingReserveSeat

超星学习通图书馆抢座脚本
78 stars 86 forks source link

配置应该都没问题,但一直显示预约失败 #42

Closed ginas1308 closed 1 month ago

ginas1308 commented 1 month ago

2024-09-26 20:06:24,969 - INFO - start time 20:06:24, action off 2024-09-26 20:06:24,969 - INFO - Global settings: SLEEPTIME: 0.2 ENDTIME: 22:00:00 CAPTCHA: default RESERVE_NEXT_DAY: True 2024-09-26 20:06:24,969 - INFO - ----------- 18110758103 -- ['09:00', '20:00'] -- ['088'] try ----------- 2024-09-26 20:06:25,607 - INFO - User iMABU3Cy0U2zRLgZLAVmxA== login successfully 2024-09-26 20:06:26,365 - INFO - Get token: 2024-09-26 20:06:26,365 - INFO - Captcha token 2024-09-26 20:06:26,365 - INFO - submit parameter {'roomId': '489', 'startTime': '09:00', 'endTime': '20:00', 'day': '2024-09-27', 'seatNum': '088', 'captcha': '', 'token': ''} 2024-09-26 20:06:26,476 - INFO - {'msg': '预约失败,请退出后重试!', 'success': False} 2024-09-26 20:06:27,354 - INFO - Get token: 2024-09-26 20:06:27,354 - INFO - Captcha token 2024-09-26 20:06:27,354 - INFO - submit parameter {'roomId': '489', 'startTime': '09:00', 'endTime': '20:00', 'day': '2024-09-27', 'seatNum': '088', 'captcha': '', 'token': ''} 2024-09-26 20:06:27,440 - INFO - {'msg': '预约失败,请退出后重试!', 'success': False} 2024-09-26 20:06:27,645 - INFO - Global settings: SLEEPTIME: 0.2 ENDTIME: 22:00:00 CAPTCHA: default RESERVE_NEXT_DAY: True

bear-zd commented 1 month ago

没有获得到页面token,可能是贵校的预约网站格式与正常的不同,如果感兴趣的话可以尝试ext分支并根据wiki进行修改

ginas1308 commented 1 month ago

没有获得到页面token,可能是贵校的预约网站格式与正常的不同,如果感兴趣的话可以尝试ext分支并根据wiki进行修改

现在获取到页面token了,然后将reserve = CAPTCHA_METHOD["custom"]后报不需要滑块验证的错,TypeError: 'NoneType' object is not subscriptable就是这个 ENABLE_SLIDER = False # 是否有滑块验证 CAPTCHA_METHOD = {"default":reserve, "slider":slidereserve, "custom":customedreserve} # default无验证方式,slider为滑块验证方式,custom为自定义验证方式 reserve = CAPTCHA_METHOD["custom"] MAX_ATTEMPT = 2 # 最大尝试次数 RESERVE_NEXT_DAY = True # 预约明天而不是今天的 全局配置

bear-zd commented 1 month ago

可以报一下详细的日志吗。此外由于customedreserve继承的是slidereserve的相关操作,所以会进行滑块验证的相关操作,可以把reserve的submit函数复制到你自己定义的customedreserve类的submit函数应该就好了

ginas1308 commented 1 month ago

这个是ext分支的 然后用了自己学校的URL,试了一下把reserve的submit的函数拿到customedreserve类替换后会出现一个token都拿不到。然后下面这个日志是没有改submit函数,只改了URL的 C:\Users\Lenovo\AppData\Local\Programs\Python\Python310\python.exe D:/图书馆代码/ChaoXingReserveSeat-ext/ChaoXingReserveSeat-ext/main.py 2024-09-27 20:37:51,722 - INFO - start time 20:37:51, action off 2024-09-27 20:37:51,722 - INFO - Global settings: SLEEPTIME: 0.2 ENDTIME: 22:01:00 CAPTCHA: custom RESERVE_NEXT_DAY: False 2024-09-27 20:37:51,722 - INFO - ----------- 18110758103 -- ['20:00', '21:00'] -- ['074'] try ----------- 2024-09-27 20:37:52,310 - INFO - User iMABU3Cy0U2zRLgZLAVmxA== login successfully 2024-09-27 20:37:52,310 - INFO - https://office.chaoxing.com/front/apps/seatengine/select?id=489&day=2024-09-27&backLevel=2&seatId=074 2024-09-27 20:37:52,957 - INFO - Get token: 1f51aaae528243e0bf3573948e834cca 2024-09-27 20:37:52,957 - INFO - Start to resolve captcha token 2024-09-27 20:37:53,181 - INFO - Successfully get prepared captcha_token 71DA11C1FA93ADD229CB4E47006F8B7A 2024-09-27 20:37:53,182 - INFO - Captcha Image URL-small https://captcha-b.chaoxing.com/slide/small/0EA2AF83FC0A0D6C2293C3718140ABE7.jpg, URL-big https://captcha-b.chaoxing.com/slide/big/0EA2AF83FC0A0D6C2293C3718140ABE7.jpg Traceback (most recent call last): File "D:\图书馆代码\ChaoXingReserveSeat-ext\ChaoXingReserveSeat-ext\main.py", line 118, in func_dict[args.method](usersdata, args.action) File "D:\图书馆代码\ChaoXingReserveSeat-ext\ChaoXingReserveSeat-ext\main.py", line 53, in main success_list = login_and_reserve(users, action, success_list) File "D:\图书馆代码\ChaoXingReserveSeat-ext\ChaoXingReserveSeat-ext\main.py", line 40, in login_and_reserve suc = s.submit(times, roomid, seatid, action) File "D:\图书馆代码\ChaoXingReserveSeat-ext\ChaoXingReserveSeat-ext\utils\customed_reserve.py", line 40, in submit captcha = self.resolve_captcha() File "D:\图书馆代码\ChaoXingReserveSeat-ext\ChaoXingReserveSeat-ext\utils\slide_reserve.py", line 18, in resolve_captcha x = self.x_distance(bg, tp) File "D:\图书馆代码\ChaoXingReserveSeat-ext\ChaoXingReserveSeat-ext\utils\slide_reserve.py", line 101, in x_distance tp_img = cut_slide(tp) File "D:\图书馆代码\ChaoXingReserveSeat-ext\ChaoXingReserveSeat-ext\utils\slide_reserve.py", line 78, in cut_slide slider_part = slider_image[:, :, :3] TypeError: 'NoneType' object is not subscriptable

进程已结束,退出代码1

bear-zd commented 1 month ago

那就是你们学校不需要用滑块解锁。拿defaultreserve里面的submit函数替代掉现在的就好了应该

tomgaveen commented 1 month ago

哥们儿 只要把c_captcha_headers里面的host的 captha-c改为captha-b就行了!!!!!! 我找了好久

bear-zd commented 1 month ago

46

ginas1308 commented 1 month ago

哥们儿 只要把c_captcha_headers里面的host的 captha-c改为captha-b就行了!!!!!! 我找了好久

nb,成功

ginas1308 commented 1 month ago

46

收到,感谢作者