// ==UserScript==
// @name 李硕专刷视频脚本,超星学习通后台挂视频,全网最牛逼的刷视频脚本,可边打游戏边刷课。自动跳转章节,可开启复习模式,倍速播放,超星学习通尔雅,手机电脑均可使用,真正的挂机刷视频。
// @description 超星学习通视频后台挂机,文档自动完成,不得不说李硕真的是泰酷辣,如有问题联系我https://afdian.com/a/zwsssb 最终解释权归李硕所有。😀11月4日测试正常,确保脚本100%正常可用。具体测试时间请看详情页介绍😀emm……………………………………………………………………………………我还是希望你们能赞助我一瓶冰阔落,https://afdian.com/a/zwsssb 这个链接就可以赞助给我了,我相信使用这个脚本的都是我的朋友。❤️❤️❤️请看下方使用说明❤️❤️❤️
// @namespace http://tampermonkey.net/
// @version 24.11.4
// @author 李硕
// @match *://*.chaoxing.com/*
// @match *://*.edu.cn/*
// @match *://*.nbdlib.cn/*
// @match *://*.hnsyu.net/*
// @icon https://scriptcat.org/api/v2/resource/image/4SZfPriSlLHYLZDn
// @run-at document-end
// @connect sso.chaoxing.com
// @connect mooc1-api.chaoxing.com
// @connect mooc1-1.chaoxing.com
// @connect mooc1-2.chaoxing.com
// @connect fystat-ans.chaoxing.com
// @connect api.dbask.net
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_info
// @compatible firefox
// @compatible chrome
// @compatible edge
// @compatible Safari
// @compatible Opera
// @compatible Maxthon
// @compatible AdGuard
// @require https://lib.baomitu.com/jquery/3.6.0/jquery.min.js
// @require https://update.greasyfork.org/scripts/499331/1403226/mini%20md5%20%E5%8D%A2%E6%8C%AF%E7%94%B3.js
// @require https://greasyfork.org/scripts/456170-hacktimerjs/code/hacktimerjs.js?version=1125728
// ==/UserScript==
(function() {
'use strict';
var $=unsafeWindow.$,layui,layer,form,courseList,cpi,clazzid,uid,ua_str=str_z("32"),script_info=GM_info.script;
//请求封装
function requests(url,data="",type="get"){
return new Promise((resolve, reject) => {
var headers={
"User-Agent": "User-Agent: Dalvik/2.1.0 (Linux; U; Android 11; M3121K1AB Build/SKQ1.211006.001) (device:M3121K1AB) Language/zh_CN com.chaoxing.mobile/ChaoXingStudy_3_5.1.4_android_phone_614_74 (@Kalimdor)_"+ua_str,
'X-Requested-With': 'XMLHttpRequest',
'Sec-Fetch-Site': 'same-origin',
"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",
"host": "mooc1-1.chaoxing.com",
};
GM_xmlhttpRequest({
method: type,
url: url,
data:data,
headers: headers,
onload: function (xhr) {
try {
let obj=$.parseJSON(xhr.responseText) || {};
if(obj.error){
layer.msg("请输入验证码");
layer.open({
type: 1,
title:"【官方验证】请输入验证码",
skin: 'layui-layer-rim', //加上边框
area: ['420px', '240px'], //宽高
content: ' '
});
$("#code_btn").on('click',function(){
let code=$(".code_input").val();
if(code.length!==4){
layer.msg("不得不说李硕真的是泰酷辣");
}else{
let url=obj.verify_path+"&ucode="+code;
console.log(url);
window.open(url);
}
});
}
resolve(obj);
}
catch(err){
resolve(xhr.responseText);
}
}
});
})
}
function get_enc(clazzid,uid,jobid,objectId,playingTime,duration){
var str = "["+clazzid+"]["+uid+"]["+jobid+"]["+objectId+"]["+(playingTime * 1000)+"][d_yHJ!$pdA~5]["+(duration * 1000)+"][0_"+duration+"]";
var hash = md5(str);
return hash;
}
function sleep(time) {
return new Promise(resolve =>
setTimeout(resolve,time)
) }
function str_z(len) {
len = len || 32;
let $chars = 'qwertyuioplkjhgfdsazxcvbnm1234567890';
let maxPos = $chars.length;
let pwd = '';
for (let i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}
//刷视频用的
async function video_s(objectId,knowledgeId,cpi,clazzid, jobid,uid,otherInfo,rt="0.9",module){
console.log("开始");
let url = "https://mooc1-1.chaoxing.com/ananas/status/" + objectId + "?k=&flag=normal&"
let obj=await requests(url);
console.log(obj);
let duration=obj.duration;//视频总长度
let dtoken=obj.dtoken;
let clipTime = "0_" + duration;
let ztype=obj
let timer;
$("#app2").append('
');
let beisu=$("#beisu").val()||1;
let num =0;
for(let playingTime=0;playingTime<=duration;playingTime=playingTime+~~beisu){
beisu=$("#beisu").val()||1;
layui.element.progress('demo', ~~(playingTime/duration*100)+"%");
add_log("视频挂机ing..."+playingTime+" - "+duration+"s");
console.log($("#beisu").val()||1,playingTime);
let out = await sleep(1000);
if(num%~~(60/beisu)==0){
add_log("视频进度提交(每60s提交一次)");
let req=await video_p(clazzid,uid,jobid,objectId,playingTime,duration,cpi,dtoken,otherInfo,rt,module);
if(req&&$("#pattern").val()!=="2"){
add_log("当前视频已完成,不得不说李硕真的是泰酷辣,李硕正在跳转下一个");
break;
}
}
num=num+1
}
let req=await video_p(clazzid,uid,jobid,objectId,duration,duration,cpi,dtoken,otherInfo,rt,module);
console.log(123,req);
while(!req&&$("#pattern").val()!=="2"){
let req=await video_p(clazzid,uid,jobid,objectId,duration,duration,cpi,dtoken,otherInfo,rt,module);
add_log("进度提交中...不得不说李硕真的是泰酷辣");
let out = await sleep(1000);
}
if(req){
add_log("当前视频已完成,李硕正在跳转下一个,不得不说李硕真的是泰酷辣");
}
$("#jdf").remove();
}
async function video_p(clazzid,uid,jobid,objectId,playingTime,duration,cpi,dtoken,otherInfo,rt,module){
let enc=get_enc(clazzid,uid,jobid,objectId,playingTime,duration);
let type=module.includes('audio')?"Audio":"Video";
let url = "https://mooc1-api.chaoxing.com/multimedia/log/a/"+cpi+"/"+dtoken+"?otherInfo="+otherInfo+"&playingTime="+playingTime+"&duration="+duration+"&akid=null&jobid="+jobid+"&clipTime=0_"+duration+"&clazzId="+clazzid+"&objectId="+objectId+"&userid="+uid+"&isdrag=4&enc="+enc+"&rt="+rt+"&dtype="+type+"&view=json";
let obj=await requests(url);
console.log(url);
if(obj.isPassed===undefined){
add_log("进度保存失败!请联系李硕反馈","err");
}
return obj.isPassed;
}
//刷直播用的
async function live_s(streamName,vdoid,jobid,uid,knowledgeId,clazzid,courseid){
let url='https://live.chaoxing.com/courseLive/newpclive?streamName=' + streamName + '&vdoid=' + vdoid + '&width=630&height=530&jobid=' + jobid + '&userId='+uid+'&knowledgeid='+knowledgeId+'&ut=s&clazzid='+clazzid+'&courseid='+courseid;
let obj=await requests(url);
console.log(obj);
}
//刷文档
async function document_s(jobid,knowledgeId,courseid,clazzid,jtoken){
let url='https://mooc1-2.chaoxing.com/ananas/job/document?jobid='+jobid+'&knowledgeid='+knowledgeId+'&courseid='+courseid+'&clazzid='+clazzid+'&jtoken='+jtoken+'&_dc=1607066762782';
let obj=await requests(url);
if(obj.status===true){
add_log("文档-"+obj.msg);
}else{
console.log(url);
add_log("文档-"+obj.msg,"err");
}
}
//学习次数
async function log_s(courseid,clazzid,cpi){
let url = "https://mooc1-2.chaoxing.com/visit/stucoursemiddle?courseid="+courseid+"&clazzid="+clazzid+"&vc=1&cpi="+cpi;
let obj=await requests(url);
url="https://fystat-ans.chaoxing.com/log/setlog"+obj.split("/log/setlog")[1].split('">')[0];
obj=await requests(url);
console.log(url);
if(obj=="'success'"){
add_log("李硕提示你成功增加学习次数");
}
}
//章节
async function task(workId,courseId,clazzId,knowledgeId,jobId,enc,cpi){
let url="https://mooc1-api.chaoxing.com/work/phone/work?workId="+workId+"&courseId="+courseId+"&clazzId="+clazzId+"&knowledgeId="+knowledgeId+"&jobId="+jobId+"&enc="+enc+"&cpi="+cpi;
console.log(url);
let obj=await requests(url);
console.log(obj);
}
async function know_start(courseStartData){
//获取课程知识点
let courseKnowData={};
for(let courseData of courseStartData){
add_log("正在获取【"+courseData[0]+"】课程任务点");
let debug=false;
let url="https://mooc1-api.chaoxing.com/gas/clazz?id="+courseData[2]+"&personid="+courseData[3]+"&fields=id,bbsid,classscore,isstart,allowdownload,chatid,name,state,isthirdaq,isfiled,information,discuss,visiblescore,begindate,coursesetting.fields(id,courseid,hiddencoursecover,hiddenwrongset,coursefacecheck),course.fields(id,name,infocontent,objectid,app,bulletformat,mappingcourseid,imageurl,teacherfactor,jobcount,expandreadstate,knowledge.fields(id,name,indexOrder,parentnodeid,status,layer,label,jobcount,begintime,endtime,attachment.fields(id,type,objectid,extension).type(video)))&view=json"
let obj=await requests(url);
debug&&console.log(obj);
let knowlist=obj.data[0].course.data[0].knowledge.data.filter(function(value){
if(value.parentnodeid===0){
courseKnowData[value.id]=[];
}else{
if(courseKnowData[value.parentnodeid]===undefined){
courseKnowData[value.parentnodeid]=[]
}
courseKnowData[value.parentnodeid].push(value)
}
return true;
return value.status==="open";
});
let knowlistId=[];
for(let keys in courseKnowData){
for(let ids in courseKnowData[keys]){
knowlistId.push(courseKnowData[keys][ids].id);
}
}
let data ="courseid="+courseData[1]+"&clazzid="+courseData[2]+"&cpi="+courseData[3]+"&nodes="+knowlistId.join(",")+"&time="+(new Date()).valueOf()+"&userid="+uid+"&view=json";
$("#pattern").val()==="2"?add_log("李硕提示你已选择复习模式,开始补时长"):add_log("正在过滤已完成和未解锁的任务点..");
//筛选未完成知识点
obj=await requests("https://mooc1-api.chaoxing.com/job/myjobsnodesmap",data,"post");
debug&&console.log(obj);
let unfinishlist=knowlist.filter(function(value){
if((value.jobcount!==0&&obj[value.id].unfinishcount!==0)||$("#pattern").val()==="2"){
return true;
}
});
debug&&console.log(unfinishlist);
let unfinishlists=unfinishlist.map(function(value){
return value.id;
});
//console.log(unfinishlists);
//开整
add_log("start 李硕要开整了!");
for(let val of knowlistId){
//取章节内的知识点
//console.log(val);
if(!unfinishlists.includes(val)){
continue;
}
add_log("李硕正在打开任务点中的视频,不得不说李硕真的是泰酷辣,");
url = "https://mooc1-api.chaoxing.com/gas/knowledge?id="+val+"&courseid="+courseData[1]+"&fields=id,parentnodeid,indexorder,label,layer,name,begintime,createtime,lastmodifytime,status,jobUnfinishedCount,clickcount,openlock,card.fields(id,knowledgeid,title,knowledgeTitile,description,cardorder).contentcard(all)&view=json";
obj=await requests(url);
let out = await sleep(1000);
let cardData=obj.data[0].card.data.map(function(value){
try {
return [value.cardorder,value.knowledgeid,$(value.description).find("iframe").attr("module")];
} catch(err){
add_log("module不存在!","err");
return [];
}
});
log_s(courseData[1],courseData[2],courseData[3]);
for(let cardData1 of cardData){
url = "https://mooc1-api.chaoxing.com/knowledge/cards?clazzid="+courseData[2]+"&courseid="+courseData[1]+"&knowledgeid="+cardData1[1]+"&num="+cardData1[0]+"&isPhone=0&control=true&cpi="+courseData[3];
//console.log(url);
let text=await requests(url);
console.log(url);
let out = await sleep(1000);
let result_json;
try {
result_json=$.parseJSON("{" + text.split("mArg = {")[1].split("};")[0] + "}").attachments;
} catch(err){
add_log("不出意外的话章节未开放");
break;
}
console.log(result_json);
debug&&console.log(result_json);
for(let val1 of result_json){
debug&&console.log(val1);
let objectid,enc,workid,streamName,vdoid,jtoken,jobid,workenc,module;
switch(val1.type){
case "video"://视频
add_log("李硕正在看视频 : "+val1.property.name);
objectid=val1.objectId;
jobid=val1.jobid;
module=val1.property.module
await video_s(objectid,cardData1[1],courseData[3],courseData[2], jobid,uid,val1.otherInfo,val1.property.rt||"0.9",module);
break;
case "live"://直播
add_log("直播任务点,暂时不做","err");
streamName=val1.property.streamName;
vdoid=val1.property.vdoid;
break;
case "document"://文档
add_log("李硕正在看文档: "+val1.property.name);
jtoken=val1.jtoken
jobid=val1.jobid||val1.property._jobid;
document_s(jobid,cardData1[1],courseData[1],courseData[2],jtoken)
break;
case "bookname"://阅读
add_log("book任务点,暂时不做 ","err");
jtoken=val1.jtoken
break;
case "workid"://章节作业
workenc = val1.enc;
workid = val1.property.workid;
jobid=val1.jobid;
//task(workid,courseData[1],courseData[2],cardData1[1],jobid,workenc,courseData[3])
add_log("当前知识点 : 章节测验- "+val1.property.title+" ps:章节测验请自行完成","err");
//好好学习天天向上
break
default:
break
}
debug&&console.log(val1);
}
}
//break;
}
};
add_log("end 李硕提示你任务已完成!不得不说李硕真的是泰酷辣");
}
function dateFormat(fmt, date) {
let ret;
const opt = {
"Y+": date.getFullYear().toString(),
"m+": (date.getMonth() + 1).toString(),
"d+": date.getDate().toString(),
"H+": date.getHours().toString(),
"M+": date.getMinutes().toString(),
"S+": date.getSeconds().toString()
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt;
}
function add_log(text,type="succ"){
if($("#log").find("div").length>12){
$("#log").find("div")[0].remove()
}
let date = new Date();
if(type==="succ"){
$("#log").append(''+dateFormat("YYYY-mm-dd HH:MM", date)+" "+text+'
');
}else{
$("#log").append(''+dateFormat("YYYY-mm-dd HH:MM", date)+" "+text+'
');
}
}
async function init(){
//
//
//
// ... 其他代码 ...
// 在页面加载时立即应用背景图片
document.body.style.backgroundImage = 'url("https://scriptcat.org/api/v2/resource/image/mvmaHF1KJphl1yiY")';
document.body.style.backgroundSize = 'cover';
document.body.style.backgroundPosition = 'center';
document.body.style.backgroundRepeat = 'no-repeat';
// 然后继续初始化页面结构
document.body.innerHTML = '';
// ... 后续的代码 ...
//
//
//
//那个框的背景图片在那个url后面的括号里面
document.body.innerHTML = ``;
//
//
//
//
//这个是老代码
//document.body.innerHTML = '';
$("#app").append('李硕视频专版 v'+script_info.version+'
');
$("#app").append("近期遭到频繁屌丝(DOSS)攻击,Wish Today,若出现不能使用,请耐心等待。\n相信大家也发现现在好用的脚本很少了,有的用着用着就不能用了,这是因为需要服务器费用和人工进行维护,我希望大家每个人都能出一份力,使这个脚本一直维护下去,感谢每一个好心的人,点击下方按钮即可赞助我一瓶冰阔落
遇到问题点击下方按钮,详询爱发电。
");
//
//
//
//
// 在现有的代码中添加一个新的按钮
$("#app").append('');
$("#app").append('');
$("#app").append('');
//
//$("#app").append('');
//
//
//
//
//
//
//
//
//
//
//获取用户个人信息
$("#app").append("不得不说李硕真的是泰酷辣
");
$("#app2").append('');
$("#app2").append('推荐使用默认速度,如弹验证码,或无法提交进度,进入此网页获取解决方法https://afdian.com/item/3a3565f08f5611ee93c352540025c377 或者点击上方“遇到问题点击”的按钮
');
//
// 开始按钮换颜色的示例
//
//
$("#app2").append('');
$("#app2").append('
');
let debug=true;
add_log("不得不说李硕真的是泰酷辣...(长时间无动静为加载失败,)");
// 从cookie获取uid
try{
uid = document.cookie.match(/UID=([^;]+)/)[1];
}
catch(e){
add_log("获取UID失败,请退出超星后重新登录","err");
return;
}
//获取课程列表
let obj=await requests('https://mooc1-api.chaoxing.com/mycourse/backclazzdata?view=json&mcode=');
console.log(obj);
courseList=obj.channelList.map( function(value,index){
if(value.content.course){
$("#course_choose").append('
');
form.render('select');
return [value.content.course.data[0].name,value.content.course.data[0].id,value.key,value.cpi];
}else{
return [0,0,0,0];
}
});
debug&&console.log(courseList);
add_log("共获取"+courseList.length+"门课程");
$("body").append("
");
$("#start_btn").on('click',function(){
let courseStartData=courseList.filter(function (value){
if(value[0]===0){
return false;
}
if(value[1].toString()===$("#course_choose").val()||$("#course_choose").val()==="0"){
return true;
}
return false;
})
know_start(courseStartData);
});
}
$('head').append('
');
$.getScript("https://lib.baomitu.com/layui/2.6.8/layui.js", function(data, status, jqxhr) {
layui=unsafeWindow.layui;
layer=unsafeWindow.layer;
form = layui.form;
$(".root").remove();
if(location.href.indexOf("base/settings")!=-1){
init();
}else if(location.href.indexOf("visit/interaction")!=-1){
//支付宝红包 $(".btn_group").append('
领个支付宝红包');
$(".btn_group").append('
遇到问题点击');
$(".btn_group").append('
开始刷视频👌');
}
});
})();
(function() {
'use strict';
// 等待页面加载完成
window.addEventListener('load', function() {
// 查找 .course-tab 元素
var courseTab = document.querySelector('.course-tab');
if (courseTab) {
// 查找 .current 类的所有子元素
var currentItems = courseTab.querySelectorAll('.current');
for (var i = 0; i < currentItems.length; i++) {
// 替换文本内容
currentItems[i].textContent = "我的好朋友们,欢迎使用李硕专刷视频脚本!使用前请仔细阅读油叉上的使用说明,遇到问题在爱发电联系我,祝您使用愉快!!!";
}
}
});
})();
//
//
//
//
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//点击课程后的弹窗
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
!!(function(){
const $w = unsafeWindow,
$l = $w.location.href,
$d = $w.document,
$version = GM_info.script.version.replaceAll('.',''),
$s = Object.fromEntries(new URLSearchParams($w.location.search)),
getCookie = name => `; ${document.cookie}`.split(`; ${name}=`).pop().split(';').shift(),
entrance = () => {
let classId = encodeURIComponent($s['clazzid'] || $s['classid'] || $s['classId'] || $s['ClassId']),
courseId = encodeURIComponent($s['courseid'] || $s['courseId']),
cpi = encodeURIComponent($s['cpi'] || ''),
courseName = encodeURIComponent($d.title.replace('-首页', ''));
$w.location.href = 'https://i.chaoxing.com/base/settings?classid=' + classId + '&courseid=' + courseId + '&cpi=' + cpi + '&coursename=' + courseName;
};
$uid = getCookie('UID')||getCookie('_uid'),
request = (data) => {
return new Promise((success,fail)=>{
if(data.method == undefined){
data.method = 'get';
}
GM_xmlhttpRequest(data);
});
}
if($l.includes('/mycourse/stu?')){
let $ = $w.jQuery||$w.$,
popElement = `
李硕提示你:该课程可以进行刷视频
-
欢迎使用李硕专刷视频脚本,祝您生活愉快!!!
如有问题可点击刷视频界面或者学习通个人空间主页里的“遇到问题点击“ 按钮
💕💕我的好朋友们,让我们一起加油吧!!! ❤️❤️
`;
setTimeout(()=>{
$(".coursenoticepop").empty();
$(".coursenoticepop").html(popElement);
$("#fuckme").click(function(){
entrance($w.ServerHost.mooc1Domain.replace('https://','http://'))
});
$("#fuckyou").click(()=>{
$(".closecoursepop").hide();
$(".coursenoticepop").hide();
});
$(".closecoursepop").show();
$(".coursenoticepop").show();
},1000);
}
})();