突破網頁頁面視頻播放速度限制
注:該方法用的是修改頁面腳本代碼突破html播放速度限制,有個缺陷就是不能直接跳多少秒,只能加快倍速。
大家不爽播放速度限制,所以現在分享一個方法。
準備東西:火狐瀏覽器或者其他瀏覽器,能裝插件的瀏覽器。
安裝插件:tampermokey:可以安裝這個插件,我也給你們,自己導入瀏覽器就行:
鏈接:https://pan.baidu.com/s/1KweKDqi31ylhjtgEKNMm3Q
提取碼:rn8d
,然後上百度搜索網站:https://greasyfork.org/zh-CN/
搜索腳本:bye-flash-hello-html5 | 再見flash 你好html5
如果你有插件直接安裝就可以了,沒有插件的話腳本無法安裝或者自己去修改頁面腳本代碼,具體的我就懶得說了,直接說使用插件。
有了插件,搜索到腳本,直接安裝,會出現:
”插件用那三個都可以,
這兩個也好用,
推薦tampermokey,方便添加腳本內容,
以tampermokey爲例:
然後在進入管理頁面:
成功之後就是下面的頁面:
在這裏的這個腳本可以是下載的,也可以是添加的,不想下載,直接複製我下面的代碼也行:
!!!注意點擊前面的啓用按鈕:
// ==UserScript==
// @name bye-flash-hello-html5 | 再見flash 你好html5
// @namespace https://greasyfork.org/en/users/131965-levinit
// @author levinit
// @description 國內主流視頻網站的HTML5播放
// @include *://*.le.com/*
// @include *://tv.cctv.com/*
// @include *://wlchunwan.cctv.com/*
// @include *://*.cntv.cn/video/*
// @include *://*.icourse163.org/*
// @include *://study.163.com/course/courseLearn*
// @include *://mooc.study.163.com/learn/*
// @include *://*.sohu.com/*html*
// @include *://*mgtv.com/*html*
// @include *://*acfun.cn/v/ac*
// @include *://*acfun.cn/bangumi/*
// @include *://m.acfun.cn/*
// @run-at document-start
// @version 1.8.1
// @grant none
// ==/UserScript==
//'use strict';
//=====
//acfun手機版主頁跳轉到pc版主頁
if (location.href.indexOf('m.acfun') >= 0) {
//手機版頻道頁跳轉到pc版頻道頁
if (location.hash.indexOf('channel') >= 0) {
const num = location.hash.match(/\d+/)[0];
location.replace('http://acfun.cn/v/list' + num + '/index.htm');
}
if (location.href === 'http://m.acfun.cn/') {
location.replace('http://acfun.cn/');
}
}
//=====
let [ua, isMobile] = [null, false]; //user-agent 和 是否使用移動ua
//這些網站使用移動ua
const sites = ['cctv', '.163', 'cntv', 'sohu', 'acfun'];
sites.forEach(curVal => {
if (location.host.indexOf(curVal) >= 0) {
isMobile = true;
return false;
}
});
//=====
if (isMobile) {
ua =
'Mozilla/5.0 (Linux; U; Android 4.0.4; GT-I9300 Build/IMM76D) AppleWebKit/601.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/601.1.46';
//Android7
//'Mozilla/5.0 (Linux; Android 7.0; PLUS Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36';
//ipad2
//"Mozilla/5.0 (iPad; U; CPU OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F191 Safari/6533.18.5";
//Android 4
} else {
//使用chrome、mac、safari等ua
if (location.host.indexOf('le.com') >= 0) {
//le.com對mac+safari情有獨鍾
ua =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0 Safari/604.3.5';
} else {
ua =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.3.5 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/604.3.5';
}
}
changeUA(ua);
//=====
//顯示播放控制條 stuyd.163
window.onload = function () {
if (
isMobile === true &&
location.href.search('study.163') >= 0
) {
const v = ele('video');
if (v) {
v.setAttribute('controls', 'controls');
}
}
};
//=====
//獲取元素對象的函數
function ele(element) {
return document.querySelector(element);
}
//更改ua的函數
function changeUA(ua) {
Object.defineProperty(navigator, 'userAgent', {
value: ua,
writable: false,
configurable: false,
enumerable: true
});
}
這些做完之後:
需要添加一條規則:舉例
添加完成後就可以播放速度限制看視頻了,得到的結果就是:
可以調調節倍速了。