之前在考RHCE,视频很好看,但是有观看有效期,一直想下某机构的精品班视频,网上看到了ali m3u8的加密下载器,就想着自己操作下载下来,以后被窝里偷摸看。以下是下载器开源地址:
https://github.com/lbbniu/aliyun-m3u8-downloader
在这里分享某机构精品班视频的下载思路。
主要还是用webdriver,其他啥也没用,丝毫没有技术含量,但是能用。网站结构改变,你代码就要变
简单明了就一步就是拿playauth和void
我也不写我的心路历程了,就简单明了给你们抛出来。
我是各种抓包结果发现某1就直接给获取上头这两东西的地址就写在网页的script里头。直接进课程地址”center/course/lesson/index?id=7065_577896“
直接在console里输入document.querySelector('body > script:nth-child(13)')
<script>let timer = null;
let finish = false;
let count = 0;
let hasSign = 0;
//阿里云播放器
var aliplayparam = {
CENTER_URL : '*****/center/',
person_num: '***',
username: '"***"',
type: 'wejoboutcourse',
lesson_id: '7065_577896',
id: 'df338cfc9c4347459ad88e8195683be',
sign: 'c0e5CFAOXgVVAAQCAQACAFFdAFMAAVcAwUAUAZVCQJfBQAFAFANBgEADABcDF1dDQNVDQEHDldTAxgHBl4FWQ1XAQUEBgw',
userid:'******',
timestr: new Date().getTime(),
random: Math.random(),
playerid: 2,
reportSwitch: true,
autoplay: true,
playcallback: function () {
if(timer) {
clearInterval(timer);
}
if(count == 0 || !finish) {
timer = setInterval(() => {
$.ajax({
url: '/center/user/sign/auto-sign',
type: 'GET',
success: function (res) {
res = JSON.parse(res);
count++;
if(res.status == '0') {
finish = true;
clearInterval(timer);
if(res.msg != '') {
$("#ctoplayerbox1").append(`<div class='record-study'>${res.msg}</div>`);
}
setTimeout(() => {
$('.record-study').remove();
}, 3000);
}
}
})
}, 31000)
}
},
}
我们就要里头的lesson_id、id和sign,抓住来再给他合并一下就好了
/center/player/play/vod-play-auth?type=wejoboutcourse&lesson_id=$lesson_id&id=$id&sign=$sign&lesson_type=course&is_try=0
然后再访问一下合并完的地址 就回返回一个json
{"status":1,"msg":"\u52a0\u8f7d\u6210\u529f","data":{"info":{"isSeventyFive":0,"playAuth":"ey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"577896","format":"m3u8","encryptType":1,"nexturl":"https:\/\/edu.51cto.com\/\/center\/course\/lesson\/index?id=7065_577895&type=wejob","prevurl":"https:\/\/edu.51cto.com\/\/center\/course\/lesson\/index?id=7065_577897&type=wejob","htime":150,"utime":1678083177,"reportLogUrl":"https:\/\/edu.51cto.com\/center\/player\/log\/time?type=wejoboutcourse"}}}
我们要的authplay 和void就在里头,直接用上头分享的工具直接下载就完事了,其他就写个脚本,直接给整个课表爬下来然后慢慢下就完事了。成品分享就再说了,写的是稀烂,就提供思路就差不多了。有authplay和void上头工具会直接合并成MP3有声音有画面,终于可以晚上被窝偷摸看了