Code Monkey home page Code Monkey logo

sustc-qiangke's Introduction

SUSTC-Qiangke

The auto choose-class script to make everybody can have classes they want to have in SUSTC or any College with Qiangzhi System. 南科大抢课,让你一键抢课!

Notice

For the change of choosing courses mode,this script is no longer useful in the first round of choosing classes in the SUSTech. But it is still useful after the beginning of a new semester.

sustc-qiangke's People

Contributors

wangdeheng-gdufs avatar youngwilliamz 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

Watchers

 avatar

sustc-qiangke's Issues

这个脚本只可以抢“跨专业选课”

选课系统有四个板块,每个版块的请求地址均不相同,他们处于不同的数据库中。
“本学期计划选课”,“专业内跨年级选课”,“跨专业选课”,“公选课”
应当在每一门课程属性中增加一个属性(p[2])
修改后代码如下:
import random

import requests
import re
import time
import json

s = requests.Session()
r = s.get('https://cas.sustech.edu.cn/cas/login?service=http%3A%2F%2Fjwxt.sustech.edu.cn%2Fjsxsd%2F')

print(str(r.content, 'utf-8'))

#记得写账号和密码
data = {
'username': '',
# 'username': '',
'password': '',
# 'password': 'abcdefg',
'execution': re.findall('on" value="(.+?)"', r.text)[0],
'_eventId': 'submit',
'geolocation': ''
}

#进入教务系统
r = s.post('https://cas.sustech.edu.cn/cas/login?service=http%3A%2F%2Fjwxt.sustech.edu.cn%2Fjsxsd%2F', data)

print(str(r.content, 'utf-8'))

print("CAS验证成功")
#查看选课是否开始
r = s.get('http://jwxt.sustech.edu.cn/jsxsd/xsxk/xklc_list?Ves632DSdyV=NEW_XSD_PYGL')
print("教务系统启动")

count = 1
while True:
count += 1
key = re.findall('href="(.+)" target="blank">进入选课', r.text)
# print(r.text)
print(str(key))
if len(key) == 1:
break
print('喵喵祈祷中……开始第 %d 次祈祷' % count)
time.sleep(random.random()*random.random())
k = key[0]
print('榴莲启动完成')
print("开始抢课")

s.get('http://jwxt.sustech.edu.cn' + k)

list = [["概率論與數理統計",'201920201001721','bxqjh']]

bxqjh-本學期計劃選課,zynknj-專業內跨年級選課,kzy-跨專業選課,gxk-公選課選課

每一門課有三個信息:["課程名稱",'課程編號','課程類別']

def add_class(oneclass):
list.append(oneclass)

def rush_all(list):
count2 = 1
while True:
print('开始第 %d 次喵喵喵' % count2)
for p in list:
count2 += 1
if rush(p):
list.remove(p)

def rush(p):
print('正在抢 %s' % p[0])
if p[2]=='bxqjh':
r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/bxqjhxkOper?jx0404id=%s&xkzy=&trjf=" % p[1])
elif p[2]=='zynknj':
r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/knjxkOper?jx0404id=%s&xkzy=&trjf=" % p[1])
elif p[2]=='kzy':
r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/fawxkOper?jx0404id=%s&xkzy=&trjf=" % p[1])
else:
r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/ggxxkxkOper?jx0404id=%s&xkzy=&trjf=" % p[1])
result = str(r.content, 'utf-8')
# print(result.find("true", 0, len(result)))
if result.find("true", 0, len(result)) >= 1:
print("抢到 "+ p[0] + " 啦")
return True
# print(str(json.loads(result)['success']) + "····\n正在继续加油!\n")
delay = random.random()*random.random()
print(result + "\n正在继续加油!\n············%f s 后" % delay)
time.sleep(delay)
return False

print("空气动力学")

r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/fawxkOper?jx0404id=201820191000460&xkzy=&trjf=")

print(str(r.content, 'utf-8'))

print("\n退课")

r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkjg/xstkOper?jx0404id=201820191000460")

print(str(r.content, 'utf-8'))

rush_all(list)

s.close()

教务系统加强防护,需要两次登入“进入选课”界面

教务系统今年加强防护,在s.get(“进入选课”界面url)后第一次会返回“学生个人中心”界面,需要再次s.get才能获取“进入选课”页面,修改后代码应如下:
import random
import requests
import re
import time
import json
s = requests.Session()
r = s.get('https://cas.sustech.edu.cn/cas/login?service=http%3A%2F%2Fjwxt.sustech.edu.cn%2Fjsxsd%2F')
#记得写账号和密码
data = {
'username': '11111',
'password': 'aaaa',
'execution': re.findall('on" value="(.+?)"', r.text)[0],
'_eventId': 'submit',
'geolocation': ''
}
#进入教务系统
r = s.post('https://cas.sustech.edu.cn/cas/login?service=http%3A%2F%2Fjwxt.sustech.edu.cn%2Fjsxsd%2F', data)

print(str(r.content, 'utf-8'))

print("CAS验证成功")
#查看选课是否开始
r = s.get('http://jwxt.sustech.edu.cn/jsxsd/xsxk/xklc_list?Ves632DSdyV=NEW_XSD_PYGL')
#再次s.get获取“进入选课”界面
r = s.get('http://jwxt.sustech.edu.cn/jsxsd/xsxk/xklc_list?Ves632DSdyV=NEW_XSD_PYGL')
print("教务系统启动")
count = 1
while True:
count += 1
key = re.findall('href="(.+)" target="blank">进入选课', r.text)
print(r.text)
print(str(key))
if len(key) == 1:
break
print('喵喵祈祷中……开始第 %d 次祈祷' % count)
time.sleep(random.random())#*random.random()
k = key[0]
print('榴莲启动完成')
print("开始抢课")
s.get('http://jwxt.sustech.edu.cn' + k)
list = [["toefl",'201920202001003','gxk']]

bxqjh-本學期計劃選課,zynknj-專業內跨年級選課,kzy-跨專業選課,gxk-公選課選課

每一門課有三個信息:["課程名稱",'課程編號','課程類別']

def add_class(oneclass):
list.append(oneclass)
def rush_all(list):
count2 = 1
while True:
print('开始第 %d 次喵喵喵' % count2)
for p in list:
count2 += 1
if rush(p):
list.remove(p)
def rush(p):
print('正在抢 %s' % p[0])
if p[2]=='bxqjh':
r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/bxqjhxkOper?jx0404id=%s&xkzy=&trjf=" % p[1])
elif p[2]=='zynknj':
r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/knjxkOper?jx0404id=%s&xkzy=&trjf=" % p[1])
elif p[2]=='kzy':
r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/fawxkOper?jx0404id=%s&xkzy=&trjf=" % p[1])
else:
r = s.get("http://jwxt.sustech.edu.cn/jsxsd/xsxkkc/ggxxkxkOper?jx0404id=%s&xkzy=&trjf=" % p[1])
result = str(r.content, 'utf-8')
if result.find("true", 0, len(result)) >= 1:
print("抢到 "+ p[0] + " 啦")
return True
delay = random.random()#*random.random()
print(result + "\n正在继续加油!\n············%f s 后" % delay)
time.sleep(delay)
return False
rush_all(list)
s.close()

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.