├── README.md ├── grabcourse.py └── xuanke.py /README.md: -------------------------------------------------------------------------------- 1 | # BUAAGetCourse 2 | 用来蹲北航教务给课程扩容的名额,解放双手双眼 3 | 4 | (换课请联系教务进行换课 小心截胡) 5 | 6 | 7 | 第一版grabcourse.py是用Selenium登陆 用requests选课 8 | 9 | 第二版xuanke.py参考了[北航教务一键评教版本](https://github.com/bearbattle/buaa-teacher-evaluation)将登陆部分更新 不再需要Selenium 仅使用requests 更方便使用 10 | 11 | `username`和`password`即账号和密码 12 | 13 | `type`是想选课的类型(一般专业课 核心专业课 核心通识课 一般专业课) 14 | 15 | `course`为想选的课程编号 16 | 17 | `rwh`的末尾默认为001 在相同课程编号有不同老师(应该只有核心专业课用到)想选同名课程的第n个则改为00n (关于核心专业课同名有多课情况建议F12使用element或者network抓选课包查看一下最保险) 18 | 19 | **grabcourse.py在2021年秋季学期测试过可正常使用** 20 | 21 | **xuanke.py在2022年春季学期测试过可正常使用** 22 | -------------------------------------------------------------------------------- /grabcourse.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.support import expected_conditions 3 | from selenium.webdriver.support import expected_conditions as EC 4 | from selenium.webdriver.support.ui import WebDriverWait 5 | from selenium.webdriver.common.by import By 6 | from selenium.webdriver.common.action_chains import ActionChains 7 | import json 8 | import time 9 | import requests 10 | from datetime import datetime 11 | import re 12 | from selenium.webdriver.chrome.options import Options 13 | 14 | 15 | def _get_hidden_items(text): 16 | ''' get hidden item of html text ''' 17 | item_pattern = re.compile(r'