Git Product home page Git Product logo

hack_my_school's Introduction

简介

利用 Ruby 简洁的特性编写爬虫,自动登陆我们学校的教务系统,获取成绩页面,得到成绩数据并格式化输出,自动计算绩点,自动生成课表等。

具体原理可参考我写的文章:

Tesseract 相关配置可参考RTesseract 使用文档

环境配置

  1. 安装 tesseract-ocr
# Ubuntu
sudo apt install tesseract-ocr
sudo apt install ImageMagick
# macOS
brew install tesseract
  1. 安装必需gem
bundle install
  1. 配置Tesseract的环境(可能不需要这步)
#从Google官网下载
wget https://tesseract-ocr.googlecode.com/files/eng.traineddata.gz
#下载完成后,移动到相应文件夹,可选择/usr或者/opt
sudo mv -v eng.traineddata /usr/local/share/tessdata/
#sudo mv -v eng.traineddata /opt/local/share/tessdata/
  1. public目录下新建account.ymlemail.yml文件,内容格式如下
# account.yml
-
  account: '100000000001' # 学号
  password: '010001'  # 密码
  subs_email: [email protected]  # 订阅邮箱
  subs_name: 宝宝一号  #订阅者姓名,或者昵称,将用于邮件主题
-
  account: '100000000002'
  password: '100002'
  subs_email: [email protected], [email protected]  # 订阅邮箱可用逗号隔开多个
  subs_name: 宝宝二号
-
  account: '100000000003'
  password: '270003'
  subs_email: # 订阅邮箱可留空,但不发送通知,也就没什么意义了
  subs_name: # 订阅者姓名若留空,邮件主题将不显示姓名
# email.yml
smtp_server: smtp.xx.com  # smtp服务器
account: [email protected]
password: xxxxxxxx

使用方式

  • 运行index.rb,挂着一直跑,有新成绩就会发邮件通知

    ruby index.rb
  • 运行get_GPA.rb,直接获取所有GPA和课程成绩,发送到邮箱

  • 运行get_calendar.rb,获取本学期课程表日历文件,发送到邮箱

TODO

  • 指导性教学计划页面获取成绩,可避免得到类似“优秀”、“中等”的成绩,以获取确切分数 根据本科生教学指导重新定义这部分计算方法
  • 分析表格,将每学期的成绩分离,以便更友好的输出以及更多的计算功能
  • 按考试日期分学期应该有容错,保证在一个学期内就可以,不必相等
  • 运行后十分钟查询一次成绩,与上一次结果对比,并写入YAML文件,如果有新增则发邮件通知
  • 尝试编写一键评估功能
  • 根据「本学期课表」自动生成日历文件发送到邮箱。

hack_my_school's People

Contributors

pujiaxun avatar

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.