c语言抢课软件,研究生抢课脚本

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

抢课脚本

本文档脚本内容适用于USTC研究生选课系统

如下文所说,你需要指定自己想选的课程号,并可以修改你想要的每次查询时间间隔

方法1 浏览器console

此方法需要每次打开选课主页手动粘贴运行脚本

Chrome下,F12快捷键打开开发者工具e8f6b0bea6c2a30f82856820379bac54.png

点击上方Console进入控制面板(如上图红圈)25ef13e96d5afc657594cc8ce848d232.png

确认当前在top域(如上图红圈),在console中粘贴如下代码,并按回车:1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45var ids = ["CH6520501", "CH6620401", "CH2522301"];

var times = 5000;

var got = [];

for (var i = 0; i < ids.length; i++) {

got.push(false);

}

var inter = setInterval(function(){

var log_string = "";

var table = frames["mainFrame"].frames["I2"].frames["xkpFrame"].document.children[0].children[1].children[0].children[0].children[2].children[0];

for (var i = 0; i < ids.length; i++) {

var line = get_line_with_id(table, ids[i]);

var people = line.children[8];

if (got[i] === false) {

if (people.childNodes[0].data != (people.childNodes[3].innerText + "/")) {

frames["mainFrame"].frames["I2"].frames["xkpFrame"].xk(ids[i]);

got[i] = true;

alert("class" + toString(i) + " get!");

} else {

log_string = log_string + line.children[3].children[0].innerText + " : " + people.childNodes[0].data + people.childNodes[3].innerText + "n";

}

}

}

for (var i = 0; i < got.length; i++) {

if (got[i] === false) {

console.log(log_string);

frames["mainFrame"].frames["I2"].frames["xkpFrame"].cxdxkc();

return;

}

}

clearInterval(inter);

alert("all get!");

return;

}, times);

function (table, id){

for (i = 1; i < table.rows.length; i++) {

if (table.rows[i].children[2].innerText == id) {

return table.rows[i];

}

}

return null;

}

每查询一次,脚本将在console中输出当次查询的人数结果:c8fc77564aba044d737f18419386f084.png

若你不想有这样的输出,将上图中Default levels中的Info取消勾选

当你想结束查询时,请刷新选课接口

方法2 使用插件Tampermonkey

此方法可以自动在选课页面打开时进行刷课,无需人工干预

在Chrome扩展商店中搜索Tampermonkey并安装,安装完成后在Chrome地址栏右侧将出现该扩展的图标:229ee14719fe7a92f0370bf3db6f6053.png

点击该图标,并选择添加新脚本,进入下图接口3a0104d3fa40f806e93b9a80a699ac8b.png

你可以:将上文中的代码粘贴到图中// Your code here...的位置,并用选课网页地址替换掉图中match之后的http开头的内容

(推荐)将编辑区中所有内容清除,替换为下文内容:1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59// @name yanjiusheng

// @namespace http://tampermonkey.net/

// @version 1.1

// @description multiple classes supported

// @author Jeffery

// @match http://mis.teach.ustc.edu.cn/gradLoginSuc.do

// @grant none

// ==/UserScript==

(function(){

;

//在这里添加你想要的课程号们,不限制个数

var ids = ["CH6520501", "CH6620401", "CH2522301"];

//在这里修改每多久查询一次,单位毫秒。不要过于频繁以免被服务器封禁。原为5000。

var times = 5000;

var got = [];

for (var i = 0; i < ids.length; i++) {

got.push(false);

}

var inter = setInterval(function(){

var log_string = "";

var table = frames["mainFrame"].frames["I2"].frames["xkpFrame"].document.children[0].children[1].children[0].children[0].children[2].children[0];

for (var i = 0; i < ids.length; i++) {

var line = get_line_with_id(table, ids[i]);

var people = line.children[8];

if (got[i] === false) {

if (people.childNodes[0].data != (people.childNodes[3].innerText + "/")) {

frames["mainFrame"].frames["I2"].frames["xkpFrame"].xk(ids[i]);

got[i] = true;

alert("class" + toString(i) + " get!");

} else {

log_string = log_string + line.children[3].children[0].innerText + " : " + people.childNodes[0].data + people.childNodes[3].innerText + "n";

//console.log(line.children[3].children[0].innerText + " : " + people.childNodes[0].data + people.childNodes[3].innerText);

}

}

}

for (var i = 0; i < got.length; i++) {

if (got[i] === false) {

console.log(log_string);

frames["mainFrame"].frames["I2"].frames["xkpFrame"].cxdxkc();

return;

}

}

clearInterval(inter);

alert("all get!");

return;

}, times);

function get_line_with_id(table, id){

for (i = 1; i < table.rows.length; i++) {

if (table.rows[i].children[2].innerText == id) {

return table.rows[i];

}

}

return null;

}

// Your code here...

})();

点击保存按钮b95faf65477d4d36b39808a327ade214.png

启用脚本方法:打开选课标签页

点击Tampermonkey扩展按钮,将出现当前脚本的开关

ec8e749e2c2c234ce81daf82d2bab655.png

打开该开关,并刷新选课页面(刷新后才开启生效),若观察到隔指定时间(5000ms)页面自动查询,或在Chrome console看到课程人数的输出并且前缀数字增加,则为开启成功:

c8fc77564aba044d737f18419386f084.png

Tip: 你可以选择开课单位,以减少每次查找的流量、时间开销

关闭脚本方法:同启用脚本的方法,仅将打开开关改为关闭开关。别忘了刷新页面!

Note:如果你有旧的抢课脚本,请在开启脚本的小弹窗关闭它并保持关闭,或在Tampermonkey管理面板永久删除它:4949695d1ed6729d85c782327371a547.png9daedb460936d2c63a1199c0f11520c8.png

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值