🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

bye-flash-hello-html5 | 再见flash 你好html5

国内主流视频网站的HTML5播放

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==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
 
  });
 
}