Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
v0.0.1-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
WCY-dt committed Jul 8, 2021
1 parent 5bf531a commit 0502210
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 7 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/SEU-NewCourseElection-Helper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: SEU-NewCourseElection-Helper

jobs:
Grab:
runs-on: windows-latest
if: github.event.repository.owner.id == github.event.sender.id

steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
- name: Run
env:
NAME: ${{ secrets.NAME }}
PASSWORD: ${{ secrets.PASSWORD }}
TURN: ${{ secrets.TURN }}
run: |
bash Init_Building_Dependencies.sh
python3 东南大学选课助手.py
1 change: 1 addition & 0 deletions Init_Building_Dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip3 install selenium requests
46 changes: 42 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
# SEU-NewCourseElection-Helper

东南大学选课助手。适配东南大学2021版选课系统
![Stars](https://img.shields.io/github/stars/wcy-dt/SEU-NewCourseElection-Helper.svg)
![Forks](https://img.shields.io/github/forks/wcy-dt/SEU-NewCourseElection-Helper.svg)

抢先预览版请点击右侧release,但由于没看到开通选课后系统的状态,一些功能还没有做。
脚本共有两个版本

如果能点个star,我将感激不尽。
- ~~在线版(利用GitHub workflow)~~开发中
- 离线版(请点击右侧Releases下载)当前更新至 v0.0.1-beta

如有意向合作,请fork走提交pr。
脚本仍在开发中,且只经过我自己的账号测试无误,可能会有亿点点bug。欢迎提交issues报告问题。

另外,能不能点个star呀(可怜🥺

## 注意!!!

- 由于网站限制以及防止请求过多导致ip被封,目前安全的刷课时间为2秒一次!不提供修改手段,但如果你精通python,也**请不要擅自修改**
- 程序**不会存储任何个人信息**,不放心的尽管查源码!
- 本人对因为程序产生的任何问题**不负责任**
- 本脚本只能用于捡漏,**请勿用于抢课**!!!
- 请务必**仔细阅读**以下使用方法!!!

## 离线版使用步骤

> 由于脚本针对GitHub workflow开发,所有操作都是为了方便自动化action,因此离线版只提供了简单的控制台程序,且操作很麻烦很别扭,请不要介意
1. 下载后打开

2. 依次输入账号、密码

3. 程序会自动弹出验证码图片,输入验证码

4. 输入选课轮次

例如:`2`就代表第二轮

5. 输入要选的课

例如:`B5710241 [05]`代表课程号为B5710241,代码为05号的老师

注意:只有一个老师的也要填写老师代号;注意中间有一个空格不要丢了

6. 等它慢慢捡漏吧

## 在线版使用步骤

即将推出。。。
54 changes: 51 additions & 3 deletions 东南大学选课助手.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ def Login(): # 登录
print(".", end="")

time.sleep(2)
elecTurn=input("\n\n选课轮次:")
driver.find_element_by_xpath(
'//*[@id="xsxkapp"]/div[4]/div/div[2]/div/table/tbody/tr[3]/td/div/div/div[6]/div[2]/label/span[1]/span').click()
'//*[@id="xsxkapp"]/div[4]/div/div[2]/div/table/tbody/tr['+str(elecTurn)+']/td/div/div/div[6]/div[2]/label/span[1]/span').click()
print(".", end="")

time.sleep(1)
Expand Down Expand Up @@ -191,6 +192,22 @@ def main():
if class_wanted[-3:-1]==teacher_num[1:3]:
print("\n\n已找到\n")
finded = True
Turn=1
elected=False
while not elected:
print("第"+str(Turn)+"次尝试")
Turn=Turn+1
tl.find_element_by_xpath(
'.//*[@class="el-row"]/button[2]').click()
try:
driver.find_element_by_xpath(
'/html/body/div[3]/div/div[3]/button[2]').click()
except Exception as eEle:
elected=True
time.sleep(2)
os.system('cls')
os.system('cls')
print("\n已成功选上!\n")
break
break
if not finded:
Expand Down Expand Up @@ -259,6 +276,22 @@ def main():
if class_wanted[-3:-1]==teacher_num[1:3]:
print("\n\n已找到\n")
finded = True
Turn=1
elected=False
while not elected:
print("第"+str(Turn)+"次尝试")
Turn=Turn+1
tl.find_element_by_xpath(
'.//*[@class="el-row"]/button[2]').click()
try:
driver.find_element_by_xpath(
'/html/body/div[3]/div/div[3]/button[2]').click()
except Exception as eEle:
elected=True
time.sleep(2)
os.system('cls')
os.system('cls')
print("\n已成功选上!\n")
break
break
if not finded:
Expand Down Expand Up @@ -317,6 +350,22 @@ def main():
if class_wanted == class_num:
print("\n\n已找到\n")
finded = True
Turn=1
elected=False
while not elected:
print("第"+str(Turn)+"次尝试")
Turn=Turn+1
tl.find_element_by_xpath(
'.//*[@class="el-row"]/button[3]').click()
try:
driver.find_element_by_xpath(
'/html/body/div[3]/div/div[3]/button[2]').click()
except Exception as eEle:
elected=True
time.sleep(2)
os.system('cls')
os.system('cls')
print("\n已成功选上!\n")
break
if not finded:
curpages = curpages+1
Expand All @@ -339,8 +388,7 @@ def main():
return

except Exception as e:
msg += '选课失败' + '\n\n' + str(e) + '\n\n'
print('\t选课失败' + '\n' + str(e))
print('\t选课中止' + '\n' + str(e))
error = True
# driver.quit()
return
Expand Down

0 comments on commit 0502210

Please sign in to comment.