Git Product home page Git Product logo

ustc-epc-bot's Introduction

**科学技术大学EPC系统自动抢课脚本

System Compiler License

版本 v2.1 更新日志(2020_03_30):

  • 支持自动选课, 根据课表优化算法自动优化课表.
  • 支持课程时间课程类型的自定义筛选.
  • 支持邮件提醒, 课表更新时系统自动通知.
  • 支持 Windows 10 系统的桌面提醒, 课表更新时系统自动通知.
  • 提供图形化操作界面.
  • 实现原理从 Selenium 方式转为 Requests 方式, 并采用多线程, 效率提升.

目录

安装及使用

针对普通用户

  • 步骤1: 在 Releases 页面下载最新版本.
  • 步骤2: 解压并双击运行 epc_bot.exe 文件.
  • 步骤3: 在设置面板中输入自己的学号, 密码, 邮箱地址及邮箱密码, 勾选允许预约的课程类型及时段, 并点击 Start 按钮. 相关设置会保存在本地的 config.json 文件中, 此后每次打开都会自动填充上一次的设置.
  • 步骤4: 当有新的课程被预约, 系统将自动发送通知.

针对 Python 程序员

  • 步骤1: 将项目克隆至本地.
    git clone https://github.com/Arsennnic/ustc-epc-bot.git
  • 步骤2: 安装相关依赖包.
    cd ustc-epc-bot/
    pip install -r requirements.txt
  • 步骤3: 运行 main.py 文件.
    python main.py

课表优化算法

  • 通过脚本抓取已选课程 Booked 与可选课程 Bookable 的数据.
  • 取 Booked 与 Bookable 的并集 All, 并对其排序:
    • 上课时间: 先→后;
    • 课程学时: 大→小;
    • 是否已经预约: 是→否.
  • 遍历排序后的 All 中的所有数据:
    • 若课程单元或课程时间与 Optimal 中已有的数据重复, 跳过;
    • 否则, 将该课程添加到 Optimal 中, 直至 Optimal 中课程学时总和达到上限
  • 计算课程安排最优解:
    • 求 Optimal 与 Booked 的交集记为 Reserved, 对应课程将不作变动;
    • 求 Booked 与 Reserved 的差集记为 Canceling, 对应课程将被取消;
    • 求 Optimal 与 Bookable 的交集记为 Booking, 对应课程将被预约.
  • 根据最优解取消/预约相应课程.

开发及测试人员

       

参考文献

ustc-epc-bot's People

Contributors

arsennnic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ustc-epc-bot's Issues

epc网站崩了

很多人用脚本,网站都崩了,然后不用脚本的更选不到课。。。 。

小bug

当已经约满4个学时而再运行软件的时候,会先取消掉最靠后的一节课,随后才进行课表优化。它取消了我第9周的课,然后给我预约了一个第10周的。。。

使用 PyInstaller 重新打包后, Selenium 运行时有黑色控制台弹出, 如何避免?

打开 Python\Lib\site-packages\selenium\webdriver\common\service.py 文件, 将

self.process = subprocess.Popen(cmd, env=self.env, close_fds=platform.system() != 'Windows', stdout=self.log_file, stderr=self.log_file, stdin=PIPE)

改写成

self.process = subprocess.Popen(cmd, stdin=PIPE, stdout=PIPE ,stderr=PIPE, shell=False, creationflags=0x08000000)

或直接用工程目录中的 lib\service.py 文件替换原生的 service.py 文件.
然后重新使用 PyInstaller 打包.

一直显示No operation to be done.

一直显示No operation to be done,没有发送过邮件,期待作者更新,可以捡漏,替换前边别人退选的课,谢谢谢谢

循环时间过长的话,SMTP链接就会loss

由于在bot.py中关于邮箱初始化的内容在bot启动以后,而发邮件在获取成功课程以后。
但是如果很久才爬取到课程,那么SMTP的邮箱链路就会释放到,过期。
这样再发送就会抛出异常。
解决方案:在输出成功日志信息时候初始化邮件对象。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.