传智播客全栈视频下载-传智播客html5游戏开发视频教程
发布时间:2023-02-09 07:06 浏览次数:次 作者:佚名
这学期我还设置了1+web测评。 我被要求每天看视频做作业。 玩游戏的时候要盯着时间,回来剪视频
太麻烦了,所以我就写了一个脚本自动切换给我,如果有练习的话会播放语音提醒
(小提示,可以使用tampermonkey的H5播放器控件实现16倍速播放,享受极致丝滑传智播客全栈视频下载,几秒一个视频,我也听朋友说传智不计算视频时长,如果视频时长是统计的,如果评分GG,酌情使用)
指示:
在传智播客视频播放页面按F12,将以下代码粘贴到控制台,回车运行
(本项目已经在GitHub上开源,如果对你有用请一路starrrrr给个赞!)
console.log("欢迎使用传智自动播放插件, 作者博客:https://www.nothamor.cn");
setTimeout(function() {
let url = window.location.href;
if(url.includes("http://stu.ityxb.com/lookPaper/busywork/")) {
auto_search();
console.log("检测到为测试页面, 开始自动查询题目");
} else if(url.includes("http://stu.ityxb.com/preview/detail/")) {
auto_play();
console.log("检测到为视频播放页面, 开始自动播放视频");
}
}, 5000);
function auto_play() {
const CLASS_LIST = document.getElementsByClassName("point-progress-box");
const CLASS_NAME = document.getElementsByClassName("point-text ellipsis");
let question_text = document.getElementsByTagName("pre")[0];
let player = document.getElementsByTagName("video")[0].id;
let question_text_value;
document.getElementById(player).click();
let counter = 0;
const TIMER = setInterval(function () {
let percent = CLASS_LIST[counter].innerHTML.replace(/\ +/g, "").replace(/[\r\n]/g, "");
let title_name = CLASS_NAME[counter].innerHTML.replace(/\ +/g, "").replace(/[\r\n]/g, "");
if (percent.includes("100%") && counter == (CLASS_LIST.length - 1)) {
clearInterval(TIMER);
alert("当前页所有视频均已播放完成");
} else if (percent.includes("100%")) {
CLASS_LIST[counter + 1].click();
player = document.getElementsByTagName("video")[0].id;
document.getElementById(player).click();
counter++;
}
if (title_name.includes("习题")) {
question_text = document.getElementsByTagName("pre")[0];
question_text_value = question_text.innerHTML;
console.log(" ");
GM_xmlhttpRequest({
method: 'GET',
url: 'http://jb.s759n.cn/chati.php?w=' + encodeURIComponent(QUESTION[counter].innerHTML),
headers: {
'Content-type': 'application/x-www-form-urlencoded',
},
data: 'q=' + encodeURIComponent(QUESTION[counter].innerHTML),
onload: function (response) {
if (response.status == 200) {
let obj = $.parseJSON(response.responseText.replace(/^操作数据失败!/, '')) || {};
obj.answer = obj.data;
console.log("题目:" + QUESTION[counter].innerHTML + "的答案为:" + obj.answer);
if (obj.code) {
} else {
console.log('服务器繁忙,正在重试...');
}
} else if (response.status == 403) {
console.log('请求过于频繁,建议稍后再试');
} else {
console.log('服务器异常,正在重试...');
}
}
});
}
}, 1000);
}
function auto_search() {
const QUESTION = document.getElementsByTagName("pre");
let counter = 0;
const SEARCH = setInterval(function() {
GM_xmlhttpRequest({
method: 'GET',
url: 'http://jb.s759n.cn/chati.php?w=' + encodeURIComponent(QUESTION[counter].innerHTML),
headers: {
'Content-type': 'application/x-www-form-urlencoded',
},
onload: function (response) {
if (response.status == 200) {
let obj = $.parseJSON(response.responseText.replace(/^操作数据失败!/, '')) || {};
console.log("第" + counter + "题" + "的答案为:" + obj.data);
if (obj.code) {
} else {
console.log('服务器繁忙,正在重试...');
}
} else if (response.status == 403) {
console.log('请求过于频繁,建议稍后再试');
} else {
console.log('服务器异常,正在重试...');
}
}
});
counter++;
if(counter == (QUESTION.length)) {
clearInterval(SEARCH);
console.log("题目搜索完成");
}
}, 1000);
}
当然还有另外一个版本,依赖浏览器插件tampermonkey,不用每次都手动输入脚本内容
可以手动添加传智播客全栈视频下载,也可以直接在油腻叉子上下载这个脚本
油腻叉下载链接:传智自动播放视频
// ==UserScript==
// @name 传智自动播放视频
// @namespace http://tampermonkey.net/
// @version 0.3
// @description 自动播放传智播客课程视频, 开发者博客:http://www.nothamor.cn
// @author nothamor
// @match *.ityxb.com/*
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
console.log("欢迎使用传智自动播放插件, 作者博客:https://www.nothamor.cn");
setTimeout(function() {
let url = window.location.href;
if(url.includes("http://stu.ityxb.com/lookPaper/busywork/")) {
auto_search();
console.log("检测到为测试页面, 开始自动查询题目");
} else if(url.includes("http://stu.ityxb.com/preview/detail/")) {
auto_play();
console.log("检测到为视频播放页面, 开始自动播放视频");
}
}, 5000);
function auto_play() {
const CLASS_LIST = document.getElementsByClassName("point-progress-box");
const CLASS_NAME = document.getElementsByClassName("point-text ellipsis");
let question_text = document.getElementsByTagName("pre")[0];
let player = document.getElementsByTagName("video")[0].id;
let question_text_value;
document.getElementById(player).click();
let counter = 0;
const TIMER = setInterval(function () {
let percent = CLASS_LIST[counter].innerHTML.replace(/\ +/g, "").replace(/[\r\n]/g, "");
let title_name = CLASS_NAME[counter].innerHTML.replace(/\ +/g, "").replace(/[\r\n]/g, "");
if (percent.includes("100%") && counter == (CLASS_LIST.length - 1)) {
clearInterval(TIMER);
alert("当前页所有视频均已播放完成");
} else if (percent.includes("100%")) {
CLASS_LIST[counter + 1].click();
player = document.getElementsByTagName("video")[0].id;
document.getElementById(player).click();
counter++;
}
if (title_name.includes("习题")) {
question_text = document.getElementsByTagName("pre")[0];
question_text_value = question_text.innerHTML;
console.log(" ");
GM_xmlhttpRequest({
method: 'GET',
url: 'http://jb.s759n.cn/chati.php?w=' + encodeURIComponent(QUESTION[counter].innerHTML),
headers: {
'Content-type': 'application/x-www-form-urlencoded',
},
data: 'q=' + encodeURIComponent(QUESTION[counter].innerHTML),
onload: function (response) {
if (response.status == 200) {
let obj = $.parseJSON(response.responseText.replace(/^操作数据失败!/, '')) || {};
obj.answer = obj.data;
console.log("题目:" + QUESTION[counter].innerHTML + "的答案为:" + obj.answer);
if (obj.code) {
} else {
console.log('服务器繁忙,正在重试...');
}
} else if (response.status == 403) {
console.log('请求过于频繁,建议稍后再试');
} else {
console.log('服务器异常,正在重试...');
}
}
});
}
}, 1000);
}
function auto_search() {
const QUESTION = document.getElementsByTagName("pre");
let counter = 0;
const SEARCH = setInterval(function() {
GM_xmlhttpRequest({
method: 'GET',
url: 'http://jb.s759n.cn/chati.php?w=' + encodeURIComponent(QUESTION[counter].innerHTML),
headers: {
'Content-type': 'application/x-www-form-urlencoded',
},
onload: function (response) {
if (response.status == 200) {
let obj = $.parseJSON(response.responseText.replace(/^操作数据失败!/, '')) || {};
console.log("第" + counter + "题" + "的答案为:" + obj.data);
if (obj.code) {
} else {
console.log('服务器繁忙,正在重试...');
}
} else if (response.status == 403) {
console.log('请求过于频繁,建议稍后再试');
} else {
console.log('服务器异常,正在重试...');
}
}
});
counter++;
if(counter == (QUESTION.length)) {
clearInterval(SEARCH);
console.log("题目搜索完成");
}
}, 1000);
}
})();
原创版权归我所有。 任何个人、团体或机构如需转载或摘录本博客全部或部分内容,请保留本博客链接或注明出处。