極客時間視頻下載
使用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 的嘗試嗅探一下