返回顶部

极客时间视频下载

极客时间视频下载

使用google浏览器,安装扩展 CocoCut设置、Tampermonkey设置、下载极客时间视频操作

使用google浏览器,安装扩展

google浏览器需要安装扩展 :

CoCoCut 以及 Tampermonkey

CoCoCut视频下载扩展 

Tampermonkey扩展

 

Tampermonkey设置

进入管理面板

 

 添加脚本
CocoCut录制完成自动保存关闭

// ==UserScript==
// @name         CocoCut录制完成自动保存关闭
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://cococut.net/zh_cn/hls.html
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var timer = window.setInterval(function(){
        console.log( $('title').text());
        let title = $('title').text();
        if( title.indexOf('完成')>-1) {
            //$('#dlVsaveBtn').click();
            $('#dlAllFinished').click();
            clearInterval(timer);
            window.opener=null;
            window.open('','_self');
            window.close();
        }
    },1000 * 3);


})();

添加脚本
极客视频加速缓存

// ==UserScript==
// @name         极客视频加速缓存
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       gsj
// @match        https://time.geekbang.org/course/detail/*
// @grant        none
// @require      https://unpkg.com/ajax-hook@1.8.3/dist/ajaxhook.min.js

// ==/UserScript==

(function() {
    'use strict';

    // Your code here...


    const m3u8UrlRegex = /^.*.m3u8$/;
    var timer ;
    hookAjax({
        //拦截回调
        onreadystatechange:function(xhr){
            //console.log("onreadystatechange called: %O",xhr)

            if (xhr.readyState === 4 && m3u8UrlRegex.test(xhr.responseURL)) {
                if(timer){
                    //window.location.reload();
                    //window.location.href=window.location.href;
                    clearInterval(timer);

                }
                var ev1 = new KeyboardEvent('keydown', {
                    keyCode: 32
                });
                document.dispatchEvent(ev1);

                if(confirm('保存视频')){
                    setTimeout(function(){

                        timer = window.setInterval(function(){
                            var ev = new KeyboardEvent('keydown', {
                                keyCode: 39
                            });
                            document.dispatchEvent(ev);
                            console.log('keydown arrow right');
                        },1000 * 2);
                    },5000);
                }

                clearInterval(timer);
                var ev2 = new KeyboardEvent('keydown', {
                    keyCode: 32
                });
                document.dispatchEvent(ev2);

            }
        }
    });

    window.onload = function(){

        //实际使用
        document.onkeydown=function(e){  //对整个页面文档监听
            var keyNum=window.event ? e.keyCode :e.which;  //获取被按下的键值
            //判断如果用户按下了空格键(keycode=32),
            if(keyNum==32){
                //alert('您按下了空格');
                clearInterval(timer);


            }
            if(keyNum==13){
                //alert('您按下了回车');
                clearInterval(timer);


            }
        }


    }

})();

Ctrl + S 保存脚本

 

 

下载极客时间视频操作

打开视频,点击CocoCut 的尝试嗅探一下

 

 

 

posted @ 2020-12-27 21:04  gz_zyg  阅读(2729)  评论(0编辑  收藏  举报