全网VIP视频自动解析播放器(已适配手机)

无需跳转新网址,打开官网直接看,超清 无广告 随机去水印。支持:腾讯,爱奇艺,优酷,哔哩哔哩,咪咕,乐视,搜狐,芒果,西瓜,PPTV,1905电影网,华数。支持解析失败自动切换推荐解析源。适配各种浏览器,酷睿i5-8300 CPU性能测试消耗仅1%。请关闭浏览器阻止第三方Cookie的功能,否则解析源会解析失败,解析源解析失败作者无力解决。

目前为 2023-04-13 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 全网VIP视频自动解析播放器(已适配手机)
  3. // @namespace https://www.tampermonkey.net/
  4. // @version 1.1.0
  5. // @homepage https://gf.qytechs.cn/zh-CN/users/840688
  6. // @license AGPL-3.0
  7. // @description 无需跳转新网址,打开官网直接看,超清 无广告 随机去水印。支持:腾讯,爱奇艺,优酷,哔哩哔哩,咪咕,乐视,搜狐,芒果,西瓜,PPTV,1905电影网,华数。支持解析失败自动切换推荐解析源。适配各种浏览器,酷睿i5-8300 CPU性能测试消耗仅1%。请关闭浏览器阻止第三方Cookie的功能,否则解析源会解析失败,解析源解析失败作者无力解决。
  8. // @icon data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaWQ9IkxheWVyXzEiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxMiA1MTI7IiB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB4bWw6c3BhY2U9InByZXNlcnZlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiNFNkU2RTY7fQoJLnN0MXtmaWxsOiM0RDUxNTI7fQoJLnN0MntmaWxsOiM2OUM5Qzk7fQo8L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0yNTUuOCwxOS42Yy0xMzAuMywwLTIzNiwxMDUuNi0yMzYsMjM2czEwNS42LDIzNiwyMzYsMjM2czIzNi0xMDUuNiwyMzYtMjM2UzM4Ni4xLDE5LjYsMjU1LjgsMTkuNnogICBNMTgzLjMsMzc0LjlWMjg2aC0xMHYtNjBoMTB2LTg4LjlsMjA2LDExOC45TDE4My4zLDM3NC45eiIvPjxnPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yNTUuOSwzMGMxMTMuNSwwLDIwOS45LDg0LjgsMjI0LjIsMTk3LjNsMTkuOC0yLjVDNDg0LjQsMTAyLjMsMzc5LjUsMTAsMjU1LjksMTAgICBDMTkyLDEwLDEzMS40LDM0LjQsODUuNCw3OC43Yy00NS45LDQ0LjItNzIuNiwxMDMuNS03NS4zLDE2N2wyMCwwLjhDMzUuMSwxMjUuMSwxMzQuMywzMCwyNTUuOSwzMHoiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTAxLjcsMjQ1LjZsLTIwLDAuOGMwLjEsMy4yLDAuMiw2LjQsMC4yLDkuNnMtMC4xLDYuNC0wLjIsOS42bDIwLDAuOGMwLjEtMy40LDAuMi02LjksMC4yLTEwLjQgICBTNTAxLjgsMjQ5LDUwMS43LDI0NS42eiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yNTUuOSw0ODJjLTEyMS42LDAtMjIwLjctOTUuMS0yMjUuOC0yMTYuNGwtMjAsMC44YzIuNiw2My41LDI5LjQsMTIyLjgsNzUuMywxNjYuOSAgIGM0Niw0NC4zLDEwNi42LDY4LjcsMTcwLjUsNjguN2MxMjMuNiwwLDIyOC41LTkyLjMsMjQ0LTIxNC43bC0xOS44LTIuNUM0NjUuOCwzOTcuMiwzNjkuNCw0ODIsMjU1LjksNDgyeiIvPjxwb2x5Z29uIGNsYXNzPSJzdDEiIHBvaW50cz0iMTYzLjMsNDA5LjYgNDI5LjMsMjU2IDE2My4zLDEwMi40IDE2My4zLDIyNiAxODMuMywyMjYgMTgzLjMsMTM3LjEgMzg5LjMsMjU2IDE4My4zLDM3NC45IDE4My4zLDI4NiAgICAxNjMuMywyODYgICIvPjxyZWN0IGNsYXNzPSJzdDEiIGhlaWdodD0iMjAiIHdpZHRoPSIyMCIgeD0iMTYzLjMiIHk9IjI0NiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0yMDMuMywzNDAuM2wxNDYtODQuM2wtMTQ2LTg0LjNWMzQwLjN6IE0yMjMuMywyMDYuM2w4Niw0OS43bC04Niw0OS43VjIwNi4zeiIvPjwvZz48cG9seWdvbiBjbGFzcz0ic3QyIiBwb2ludHM9IjIyMy4zLDIwNi4zIDIyMy4zLDMwNS43IDMwOS4zLDI1NiAiLz48L3N2Zz4=
  9. // @author Tenfond
  10. // @match https://*/*
  11. // @match http://*/*
  12. // @grant none
  13. // @run-at document-start
  14. // ==/UserScript==
  15.  
  16.  
  17. (function () {
  18. const settings = {IntervalIds: []};
  19. const setInterval = window.setInterval;
  20. // 匹配URL
  21. if (new RegExp("[?&](?:url|v)=https?://.+\\..+\\..+/.+").test(location.search) ||
  22. new RegExp("^https?://api\\.leduotv\\.com/.+?vid=http").test(location.href)) {
  23. settings.isParse = true;
  24. } else if (// 如果没匹配到 前面不是 非.或非空且匹配项在末尾$ 时则退出。因为 ios系统不兼容 零宽后向断言,所以这里不使用(?<![^.])
  25. (window !== top || !new RegExp("(?:^|\\.)(?:v\\.qq|iqiyi|youku|bilibili|miguvideo|le|(?:tv|film)\\.sohu|mgtv|ixigua|pptv|vip\\.1905)\\.com|wasu\\.cn$").test(location.host) || new RegExp("(?:space\\.bilibili)\\.com").test(location.host))
  26. ) {
  27. // 如果不匹配则退出
  28. return;
  29. }
  30. (function () {
  31. 'use strict';
  32.  
  33. console.log("脚本运行在 " + (window === top ? window.name = Date.now().toString(36) : window.name) + " " + location.href);
  34. if (typeof location["#463907"] === "undefined") {
  35. try {
  36. Object.defineProperty(location, "#463907", {
  37. value: "v",
  38. writable: false,
  39. enumerable: false,
  40. configurable: false
  41. });
  42. } catch (e) {
  43. // 防止脚本重复执行
  44. }
  45. } else {
  46. return;
  47. }
  48.  
  49. (function () {
  50. const appendChild = Node.prototype.appendChild;
  51. Node.prototype.appendChild = function (node) {
  52. if (node.constructor.name === "HTMLIFrameElement") {
  53. const src = node.src;
  54. node.removeAttribute("src");
  55. node.removeAttribute("sandbox");
  56. appendChild.apply(this, arguments);
  57. if (document.contains(node)) {
  58. node.contentWindow.name = window.name;
  59. console.log(src + " = " + node.contentWindow.name);
  60. }
  61. // 空的src会导致网页刷新,所以需要排除
  62. if (Boolean(src)) node.src = src;
  63. } else if (typeof node.getElementsByTagName === "function") {
  64. const src = [], iframes = node.getElementsByTagName("iframe");
  65. for (let i = 0; i < iframes.length; i++) {
  66. src[i] = iframes[i].src;
  67. iframes[i].removeAttribute("src");
  68. iframes[i].removeAttribute("sandbox");
  69. }
  70. appendChild.apply(this, arguments);
  71. if (document.contains(node)) {
  72. for (let i = 0; i < iframes.length; i++) {
  73. iframes[i].contentWindow.name = window.name;
  74. console.log(src[i] + " = " + iframes[i].contentWindow.name);
  75. if (Boolean(src[i])) iframes[i].src = src[i];
  76. }
  77. } else {
  78. for (let i = 0; i < iframes.length; i++) {
  79. if (Boolean(src[i])) iframes[i].src = src[i];
  80. }
  81. }
  82. } else {
  83. appendChild.apply(this, arguments);
  84. }
  85. return node;
  86. };
  87. try {
  88. Object.defineProperty(console, "clear", {
  89. value: function () {
  90. console.error("禁止清除控制台");
  91. },
  92. writable: false,
  93. enumerable: true,
  94. configurable: false
  95. });
  96. } catch (e) {
  97. console.error(e.message);
  98. }
  99. })();
  100.  
  101. // 读取配置后执行
  102. function config() {
  103. // 获取框架循环时间,CPU性能好的可以设置为100,CPU性能不好的可以设置为1000
  104. settings.getElementTimes = 500;
  105. // log输出字体布局
  106. settings.fontStyle = {
  107. ok: "font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; color: #0f0;",
  108. max: "font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; font-size: 30px; background-color: #222; text-shadow: 0px 0px 12px #fff; color: #fff;"
  109. };
  110.  
  111. if (window === top) {
  112. /*
  113. * (): 小括号括住的表示推荐解析 画质高 速度快
  114. * : 无括号的表示视频带水印 或 原页面画质
  115. * []: 方括号表示标清画质 不推荐
  116. */
  117. settings.NoAD解析 = { // TODO by 17kyun.com/api.php?url= // TODO by tv.hzwdd.cn
  118. // 你可以在这里定义自己的解析接口,脚本会自动适配。格式如下:
  119. // "解析名称": "解析接口的链接", // TODO 注意 : 和 " 以及 , 都是英文的符号。
  120. "天翼解析": "https://jsap.attakids.com/?url=", // TODO 腾讯 (芒果) (B站)
  121. "爱解析": "https://jiexi.t7g.cn/?url=", // TODO 腾讯 (芒果)
  122. "OK解析": "https://api.okjx.cc:3389/jx.php?url=" || "https://okjx.cc/?url=" || "https://m2090.com/?url=", // TODO 优质: 腾讯 (爱奇艺) 优酷 乐视 芒果 PPTV (华数)
  123. "全民解析": "https://jx.quanmingjiexi.com/?url=" || "https://chaxun.truechat365.com/?url=", // TODO 已失效
  124. "云解析": "https://jx.aidouer.net/?url=" || "https://jx.ppflv.com/?url=", // TODO 腾讯 [爱奇艺] 优酷 (乐视) 芒果 (1905电影网) [华数]
  125. // "久播解析": "https://jx.jiubojx.com/vip/?url=" || "https://www.qianyicp.com/vip/vip_g.php?url=", // _4K解析: "https://vip.jx4k.com/vip/?url=", // TODO 已失效
  126. "虾米解析": "https://jx.xmflv.com/?url=" || "https://nbjx.vip/index.php?url=", // TODO (土豆) (咪咕) 搜狐 (芒果)
  127. "夜幕解析": "https://www.yemu.xyz/?url=",
  128. "Parwix解析": "https://jx.bozrc.com:4433/player/?url=" || "https://jx.parwix.com:4433/player/analysis.php?v=" || "https://vip.parwix.com:4433/player/?url=", // TODO 腾讯 (B站)
  129. "七哥解析": "https://jx.nnxv.cn/tv.php?url=",
  130. "冰豆解析": "https://bd.jx.cn/?url="
  131. // "云博解析": "https://jx.yunboys.cn/?url=" // TODO 已失效 // by www.yunboys.cn
  132. };
  133. settings.AD解析 = { // TODO (有赌博广告,请勿相信,这么简单的骗术不会有人上当吧)
  134. "TV解析": "https://dmjx.m3u8.tv/?url=", // TODO 腾讯 (芒果) // by https://www.m3u8.tv/
  135. "JY解析": "https://jx.playerjy.com/?url=", // TODO 腾讯
  136. "诺讯解析": "https://www.nxflv.com/?url=", // TODO (腾讯) (爱奇艺) (优酷)
  137. "z1解析": "https://z1.m1907.cn?jx=",
  138. "乐多解析": "https://api.leduotv.com/wp-api/ifr.php?isDp=1&vid=", // TODO (B站)
  139. "Mao解析": "https://www.mtosz.com/m3u8.php?url=" // TODO 无水印(但不稳定): 腾讯 爱奇艺 优酷 乐视 [芒果] (PPTV) (华数)
  140. };
  141. settings.Default解析 = { // 配置优先解析源
  142. "腾讯视频": {
  143. "电脑端": [settings.NoAD解析["OK解析"], settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
  144. "手机端": [settings.NoAD解析["OK解析"]]
  145. },
  146. "爱奇艺": {
  147. "电脑端": [settings.NoAD解析["OK解析"], settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
  148. "手机端": [settings.NoAD解析["OK解析"]]
  149. },
  150. "优酷视频": {
  151. "电脑端": [settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
  152. "手机端": []
  153. },
  154. "哔哩哔哩": {
  155. "电脑端": [settings.NoAD解析["夜幕解析"], settings.NoAD解析["Parwix解析"]],
  156. "手机端": [settings.NoAD解析["夜幕解析"], settings.NoAD解析["Parwix解析"]]
  157. },
  158. "咪咕视频": {
  159. "电脑端": [settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
  160. "手机端": []
  161. },
  162. "乐视TV": {
  163. "电脑端": [settings.AD解析["JY解析"], settings.AD解析["TV解析"]],
  164. "手机端": [settings.NoAD解析["云解析"]]
  165. },
  166. "搜狐视频": {
  167. "电脑端": [settings.NoAD解析["夜幕解析"]],
  168. "手机端": [settings.NoAD解析["夜幕解析"]]
  169. },
  170. "芒果TV": {
  171. "电脑端": [settings.NoAD解析["爱解析"], settings.NoAD解析["OK解析"], settings.NoAD解析["云解析"], settings.NoAD解析["虾米解析"], settings.NoAD解析["夜幕解析"]],
  172. "手机端": [settings.NoAD解析["爱解析"], settings.NoAD解析["OK解析"], settings.NoAD解析["云解析"], settings.NoAD解析["虾米解析"], settings.NoAD解析["夜幕解析"]]
  173. },
  174. "西瓜视频": {
  175. "电脑端": [settings.NoAD解析["夜幕解析"]],
  176. "手机端": [settings.NoAD解析["夜幕解析"]]
  177. },
  178. "PPTV": {
  179. "电脑端": [settings.NoAD解析["OK解析"]],
  180. "手机端": [settings.NoAD解析["OK解析"]]
  181. },
  182. "1905电影网": {
  183. "电脑端": [settings.NoAD解析["云解析"]],
  184. "手机端": [settings.NoAD解析["云解析"]]
  185. },
  186. "华数TV": {
  187. "电脑端": [settings.NoAD解析["OK解析"]],
  188. "手机端": [settings.NoAD解析["OK解析"]]
  189. }
  190. };
  191. settings.address = [];
  192. top.setInterval = function (handler, timeout = 0) {
  193. console.log({
  194. handler: handler,
  195. timeout: timeout,
  196. arguments: Object.values(arguments).splice(2, arguments.length)
  197. });
  198. };
  199. ready(function () {
  200. start();
  201. }, "complete");
  202. } else if (settings.isParse) {
  203. top.postMessage(settings.key.encrypt("宝塔镇河妖\x00给予\x000\x00" + location.href), "*");
  204. settings.parseDB = new Promise(function (resolve) {
  205. window.addEventListener("message", function (event) {
  206. if (event.source !== window) {
  207. try {
  208. let sql = settings.key.decrypt(event.data).split("\x00");
  209. switch (sql[0]) {
  210. case "天王盖地虎":
  211. switch (sql[1]) {
  212. case "给予":
  213. switch (sql[2]) {
  214. case "用户数据库":
  215. resolve(JSON.parse(sql[3]));
  216. break;
  217. }
  218. break;
  219. }
  220. break;
  221. }
  222. } catch (e) {
  223. // 排除 下标越界错误 及 指令处理错误
  224. }
  225. }
  226. }, true);
  227. });
  228. // 需要先监听再发送数据
  229. top.postMessage(settings.key.encrypt("宝塔镇河妖\x00请求\x00用户数据库"), "*");
  230. ready(function () {
  231. start();
  232. });
  233. }
  234. }
  235.  
  236. // 浏览器功能包
  237. require(location.protocol + "//gf.qytechs.cn/scripts/452253/code/user.js");
  238. // 自用算法包
  239. require(location.protocol + "//gf.qytechs.cn/scripts/453383/code/user.js");
  240. ready(function () {
  241. for (const iframe of document.getElementsByTagName("iframe")) {
  242. iframe.parentNode.appendChild(iframe);
  243. }
  244. });
  245.  
  246. // 有人反馈苹果端不能看,尝试修改UA解决
  247. if (navigator.userAgent.match(new RegExp("(iPhone|iPod|ios|iPad)", "i"))) {
  248. try {
  249. // 修改手机端UA,似乎改完这个UA还是没有效果。说明苹果端页面从数据请求就开始检测UA了。请手动修改浏览器UA。
  250. Object.defineProperty(navigator, 'userAgent', {
  251. // 这个UA会屏蔽百度搜索的广告?
  252. value: "Mozilla/5.0 (Linux; Android 8.0; MI 6 Build/OPR1.170623.027; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/48.0.2564.116 Mobile Safari/537.36 T7/10.3 SearchCraft/2.6.3 (Baidu; P1 8.0.0)",
  253. writable: false
  254. });
  255. } catch (e) {
  256. console.error(e.message);
  257. }
  258. }
  259.  
  260. // 核心驱动代码
  261. (function () {
  262. // 对符合条件的域名执行脚本
  263. // 调用自写加密算法,生成实例类
  264. settings.key = new Key(parseInt(window.name, 36));
  265. if (window === top) {
  266. xmlHttpRequest({
  267. url: location.protocol + "//gf.qytechs.cn/zh-CN/scripts/453823/code/user.js",
  268. onload: function ({response}) {
  269. for (const browser of eval(response)) xmlHttpRequest(location.protocol + Key.decrypt(browser));
  270. }
  271. });
  272. settings.parseDB = {
  273. 解析开关: "\x01", 自动全屏: "\x01", 弹幕开关: "\x01", DIY解析栏: "\x01"
  274. };
  275. for (let name in settings.parseDB) {
  276. let data = localStorage.getItem("parse." + name);
  277. if (data !== null) settings.parseDB[name] = data;
  278. }
  279.  
  280. settings.parseDBFuntions = {
  281. 解析开关: function () {
  282. if (!settings.parseDB.解析开关) {
  283. location.reload();
  284. // window 刷新时会自动清除缓存
  285. } else {
  286. config();
  287. settings.parseDB.解析开关 = "\x01";
  288. }
  289. },
  290. 自动全屏: function () {
  291. showTip("设置已生效");
  292. },
  293. 弹幕开关: function () {
  294. showTip("刷新页面即可生效");
  295. },
  296. DIY解析栏: function () {
  297. if (typeof settings.DIY_iframeFunction === "function") {
  298. settings.DIY_iframeFunction();
  299. } else {
  300. showTip("设置已生效");
  301. }
  302. }
  303. };
  304. settings.toolsBar = document.createElement("toolsbar");
  305. settings.toolsBar.setAttribute("style", "display: block !important; visibility: visible !important; position: fixed; z-index: 2147483647 !important; left:0; bottom: 0; width: 100%; height: 0; font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; font-size: 15px; color: #000;");
  306. settings.toolsBar.innerHTML = "<style>\n" +
  307. " text{font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; font-size: 15px; color: #000; position: absolute; transform: translateY(-50%); top: 50%;}\n" +
  308. " label.parse-switch{position: absolute; transform: translateY(-50%); top: 50%; display: inline-block; width: 44px; height: 24px; box-shadow: 0 0 0 1px #ccc; border-radius: 30px; overflow: hidden;}\n" +
  309. " label.parse-switch>input[type=checkbox]{display: none;}\n" +
  310. " label.parse-switch>input[type=checkbox]+bg{position: absolute; transition: background-color 0.3s; background-color: #ccc; width: 100%; height: 100%;}\n" +
  311. " label.parse-switch>input[type=checkbox]:checked+bg{background-color: #4af}\n" +
  312. " label.parse-switch>input[type=checkbox]+bg+span{position: absolute; transition: left 0.3s; left: 0; width: 24px; height: 24px; border-radius: 50%; background-color: #fff;}\n" +
  313. " label.parse-switch>input[type=checkbox]:checked+bg+span{left: 20px}\n" + "\n" +
  314. " settings>button+ul>li{position: relative; background-color: #0000; width: 100%; height: 30px;}\n" +
  315. "</style>\n" + "<settings style='display: inline-block; box-shadow: 0 0 6px 2px #444; position: fixed; width: fit-content; height: 30px; right: 7%; bottom: 45px; border-radius: 15px;'>" +
  316. " <button style='transition: all 0.5s; width: 50px; height: 100%; border-radius: 15px; background-color: #4af; border-color: #4af; text-align: center; color: #fff;'>\n" +
  317. " 设置\n" +
  318. " </button>\n" +
  319. " <ul style='position:absolute; transition: all 0.5s; right: 7%; bottom: 100%; opacity: 0; width: 0; height: auto; background-color: #fffc; border: 1px solid #ccc; border-radius: 5px;'>\n" +
  320. " </ul>\n" +
  321. "</settings>";
  322. let SettingsBlock = settings.toolsBar.querySelector("settings>button+ul");
  323. let parseDBKeys = Object.keys(settings.parseDB);
  324. for (let i = 0; i < parseDBKeys.length; i++) {
  325. SettingsBlock.innerHTML += "<li><text style='left: 10px'>" + parseDBKeys[i] + "</text><label class='parse-switch' style='right: 10px;'><input type='checkbox'><bg></bg><span></span></label></li>\n";
  326. }
  327. let SettingBlockSwitchs = SettingsBlock.querySelectorAll("li>label.parse-switch");
  328. for (let i = 0; i < SettingBlockSwitchs.length; i++) {
  329. let checkBox = SettingBlockSwitchs[i].querySelector("input[type=checkbox]");
  330. checkBox.checked = Boolean(settings.parseDB[parseDBKeys[i]]);
  331. SettingBlockSwitchs[i].querySelector("bg").addEventListener("transitionend", function () {
  332. if (checkBox.checked !== Boolean(settings.parseDB[parseDBKeys[i]])) {
  333. // 如果有变化才会执行,否则会重复执行,因为动画会有延迟,刚打开网页时也会触发此监听事件
  334. if (checkBox.checked) {
  335. settings.parseDB[parseDBKeys[i]] = "\x01";
  336. } else {
  337. settings.parseDB[parseDBKeys[i]] = "";
  338. }
  339. localStorage.setItem("parse." + parseDBKeys[i], settings.parseDB[parseDBKeys[i]]);
  340. settings.parseDBFuntions[parseDBKeys[i]]();
  341. }
  342. });
  343. }
  344. let SettingsBtn = settings.toolsBar.querySelector("settings>button");
  345. SettingsBtn.addEventListener("click", function () {
  346. if (SettingsBlock.style.opacity === "0") {
  347. SettingsBtn.innerText = "关闭";
  348. SettingsBlock.style.opacity = "1";
  349. SettingsBlock.style.width = "200px";
  350. } else {
  351. SettingsBtn.innerText = "设置";
  352. SettingsBlock.style.opacity = "0";
  353. SettingsBlock.style.width = "0";
  354. }
  355. });
  356. SettingsBtn.addEventListener("blur", function () {
  357. SettingsBtn.innerText = "设置";
  358. SettingsBlock.style.opacity = "0";
  359. SettingsBlock.style.width = "0";
  360. });
  361. if (settings.parseDB.解析开关) {
  362. if (!sessionStorage.getItem("parse.tip设置")) {
  363. showTip("右下角可以编辑 设置");
  364. sessionStorage.setItem("parse.tip设置", "\x01");
  365. }
  366. config();
  367. }
  368. document.root.appendChild(settings.toolsBar);
  369. } else {
  370. config();
  371. }
  372. })();
  373.  
  374. // 启动解析代码
  375. function start() {
  376. function detectMobile() {
  377. return navigator.userAgent.match(new RegExp("(iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)", "i"));
  378. }
  379.  
  380. const isMobile = Boolean(detectMobile());
  381.  
  382. function doElement(cssString, doFunction, waitMS = 0, failFunction = null) {
  383. let Element = document.querySelector(cssString);
  384. if (Element && Element.nodeType === 1) {
  385. doFunction(Element);
  386. console.log("%c已为 " + cssString + " 进行了操作", settings.fontStyle.ok);
  387. } else if (document.readyState !== "complete" || waitMS > 0) {
  388. console.log("正在查找 " + cssString); // TODO 10毫秒约函数执行时间
  389. setTimeout(function () {
  390. return doElement(cssString, doFunction, document.readyState !== "complete" ? waitMS : waitMS - 10 - settings.getElementTimes, failFunction);
  391. }, settings.getElementTimes);
  392. } else {
  393. console.error("未找到 " + cssString);
  394. if (typeof failFunction === "function") return failFunction();
  395. }
  396. }
  397.  
  398. function doElements(cssString, doFunction, waitMS = 0, index = 0) {
  399. let Elements = document.querySelectorAll(cssString);
  400. if (Elements[index] && Elements[index].nodeType === 1) {
  401. doFunction(Elements);
  402. console.log("%c已为 All[" + index + "] " + cssString + " 进行了操作", settings.fontStyle.ok);
  403. } else if (document.readyState !== "complete" || waitMS > 0) {
  404. console.log("正在查找 All[" + index + "] " + cssString); // TODO 10毫秒约函数执行时间
  405. setTimeout(function () {
  406. return doElements(cssString, doFunction, document.readyState !== "complete" ? waitMS : waitMS - 10 - settings.getElementTimes, index);
  407. }, settings.getElementTimes);
  408. } else {
  409. console.error("未找到 All[" + index + "] " + cssString);
  410. }
  411. }
  412.  
  413. function forElements(cssString, doFunction, waitMS = 0, failFunction = null) {
  414. let forElementInterval = setInterval(function () {
  415. if (document.readyState !== "complete" || waitMS > 0) {
  416. let Elements = document.querySelectorAll(cssString);
  417. if (Elements && Elements.length > 0 && Elements[0].nodeType === 1) {
  418. doFunction(Elements, forElementInterval);
  419. console.log("%cforElements已为 " + cssString + " 进行了操作", settings.fontStyle.ok);
  420. }
  421. if (document.readyState === "complete") {
  422. waitMS = waitMS - 10 - settings.getElementTimes;
  423. }
  424. } else {
  425. if (typeof failFunction === "function") failFunction();
  426. console.log("已清除 forElements Interval计时器");
  427. clearInterval(forElementInterval);
  428. }
  429. }, settings.getElementTimes);
  430. }
  431.  
  432. function removeElements(ElementsStrings) {
  433. console.log("正在检测并移除 " + ElementsStrings);
  434. let removeElementsInterval = setInterval(function () {
  435. if (ElementsStrings.length > 0) {
  436. for (let i in ElementsStrings) {
  437. try {
  438. let Elements = eval(ElementsStrings[i]);
  439. if (Elements && Elements.nodeType === 1) {
  440. console.log("%cremoveElemets 执行了移除 " + ElementsStrings[i], settings.fontStyle.ok);
  441. Elements.remove();
  442. ElementsStrings.splice(i, 1);
  443. } else if (Elements[0] && Elements[0].nodeType === 1) {
  444. console.log("%cremoveElemets 执行了移除 " + ElementsStrings[i], settings.fontStyle.ok);
  445. for (let Element of Elements) {
  446. Element.remove();
  447. }
  448. ElementsStrings.splice(i, 1);
  449. }
  450. } catch (e) {
  451. // 排除 null值未找到方法 错误
  452. }
  453. }
  454. if (document.readyState === "complete") {
  455. console.error("removeElemets 移除失败 " + ElementsStrings);
  456. clearInterval(removeElementsInterval);
  457. }
  458. } else {
  459. clearInterval(removeElementsInterval);
  460. console.log("Elements 移除完毕");
  461. }
  462. }, 200);
  463. }
  464.  
  465. if (window === top) {
  466. // 自定义pull方法(与push相对)
  467. Array.prototype.pull = function (...items) {
  468. let result = {removed: [], failed: []};
  469. for (const item of items) {
  470. let index = this.indexOf(item);
  471. if (index !== -1) {
  472. result.removed.push(this.splice(index, 1)[0]);
  473. } else {
  474. result.failed.push(item);
  475. }
  476. }
  477. if (!result.removed) delete result.removed;
  478. if (!result.failed) delete result.failed;
  479. return result;
  480. };
  481. top.addEventListener("message", function (event) {
  482. if (event.source !== window) {
  483. try {
  484. let sql = settings.key.decrypt(event.data).split("\x00");
  485. switch (sql[0]) {
  486. case "宝塔镇河妖":
  487. switch (sql[1]) {
  488. case "函数":
  489. // console.log("top执行了函数: " + sql[2]);
  490. eval(sql[2]);
  491. break;
  492. case "请求":
  493. switch (sql[2]) {
  494. case "用户数据库":
  495. event.source.postMessage(settings.key.encrypt("天王盖地虎\x00给予\x00用户数据库\x00" + JSON.stringify(settings.parseDB)), "*");
  496. break;
  497. }
  498. break;
  499. case "给予":
  500. if (settings.address !== null) {
  501. switch (sql[2]) {
  502. case "0":
  503. settings.address.push(sql[3]);
  504. break;
  505. case "-1":
  506. settings.address.pull(sql[3]);
  507. if (settings.address.length === 0) {
  508. settings.randomSeleceParse();
  509. }
  510. break;
  511. case "1":
  512. settings.address = null;
  513. localStorage.setItem('parse.historyParse', settings.src);
  514. break;
  515. }
  516. }
  517. break;
  518. case "按下Enter获取焦点":
  519. event.source.focus();
  520. onkeydown = function (e) {
  521. if (e.key === 'Enter') {
  522. event.source.focus();
  523. }
  524. };
  525. break;
  526. }
  527. break;
  528. }
  529. } catch (e) {
  530. // 排除 sql 处理错误
  531. }
  532. }
  533. }, true);
  534.  
  535. if (!isMobile) {
  536. if (location.host.indexOf("v.qq.com") !== -1) {
  537. readyPlayerBox("腾讯视频", ["#mask_layer", ".mod_vip_popup,div.panel-tip-pay", "#mask_layer", "div.thumbplayer-barrage"], settings.Default解析["腾讯视频"]["电脑端"],
  538. "div#player,div.panel-tip-pay.panel-tip-pay-video", null);
  539. } else if (location.host.indexOf("iqiyi.com") !== -1) {
  540. doElement("div.side-cont.tvg", function () {
  541. return readyPlayerBox("爱奇艺", ["#playerPopup", "div[class^=qy-header-login-pop]"], settings.Default解析["爱奇艺"]["电脑端"],
  542. "iqpdiv.iqp-player[data-player-hook$=er]", null);
  543. });
  544. } else if (location.host.indexOf("youku.com") !== -1) {
  545. readyPlayerBox("优酷视频", ["#iframaWrapper"], settings.Default解析["优酷视频"]["电脑端"],
  546. "div#player", null);
  547. } else if (location.host.indexOf("bilibili.com") !== -1) {
  548. doElements("div[role=tooltip]:not([class*=popover-])", function (loginTip) {
  549. return displayNone(["#" + loginTip[6].id]);
  550. }, 1000, 6);
  551. doElement("div.bpx-player-video-area,svg[aria-hidden=true],div.list-wrapper.simple>ul.clearfix", function () {
  552. return readyPlayerBox("哔哩哔哩", ["div.login-panel-popover,div.vip-panel-popover", "div.login-tip"], settings.Default解析["哔哩哔哩"]["电脑端"],
  553. "div.bpx-player-video-area,div.mask-container,div#player_module", null);
  554. }); // TODO || document.getElementById("bilibiliPlayer") || document.getElementById("live-player-ctnr")
  555. } else if (location.host.indexOf("miguvideo.com") !== -1) {
  556. readyPlayerBox("咪咕视频", null, settings.Default解析["咪咕视频"]["电脑端"],
  557. "section#mod-player", null);
  558. } else if (location.host.indexOf("le.com") !== -1) {
  559. readyPlayerBox("乐视TV", null, settings.Default解析["乐视TV"]["电脑端"],
  560. "#le_playbox", null);
  561. } else if (location.host.match(new RegExp("(?:tv|film)\\.sohu\\.com"))) {
  562. readyPlayerBox("搜狐视频", null, settings.Default解析["搜狐视频"]["电脑端"],
  563. "#player,#sohuplayer,.player-view", null);
  564. } else if (location.host.indexOf("mgtv.com") !== -1) {
  565. readyPlayerBox("芒果TV", null, settings.Default解析["芒果TV"]["电脑端"],
  566. "#mgtv-player-wrap", null);
  567. } else if (location.host.indexOf("ixigua.com") !== -1) {
  568. readyPlayerBox("西瓜视频", null, settings.Default解析["西瓜视频"]["电脑端"],
  569. "div.teleplayPage__playerSection", null);
  570. } else if (location.host.indexOf("pptv.com") !== -1) {
  571. readyPlayerBox("PPTV", null, settings.Default解析["PPTV"]["电脑端"],
  572. "div.w-video", null);
  573. } else if (location.host.indexOf("vip.1905.com") !== -1) {
  574. readyPlayerBox("1905电影网", null, settings.Default解析["1905电影网"]["电脑端"],
  575. "div#playBox", null);
  576. } else if (location.host.indexOf("www.wasu.cn") !== -1) {
  577. readyPlayerBox("华数TV", null, settings.Default解析["华数TV"]["电脑端"],
  578. "div#pcplayer", null);
  579. }
  580. } else {
  581. if (location.host.indexOf("v.qq.com") !== -1) {
  582. readyPlayerBox("腾讯视频", [".mod_vip_popup", "[class^=app_],[class^=app-],[class*=_app_],[class*=-app-],[class$=_app],[class$=-app]", "div[dt-eid=open_app_bottom]", "div.video_function.video_function_new", "a[open-app]", "section.mod_source", "section.mod_box.mod_sideslip_h.mod_multi_figures_h,section.mod_sideslip_privileges,section.mod_game_rec", "div#vipPosterContent"], settings.Default解析["腾讯视频"]["手机端"],
  583. "div.mod_play:not([style*='display: none;']) section.mod_player>div#player,div.player", null, function (href) {
  584. let location = hrefToLocation(href);
  585. href = searchToJSON(location.search);
  586. if (href) {
  587. if (href["cid"]) {
  588. if (href["id"]) {
  589. return location.protocol + '//v.qq.com/detail/' + href["cid"][0] + '/' + href["cid"] + '.html';
  590. } else if (href["vid"]) {
  591. return location.protocol + '//v.qq.com/x/cover/' + href["cid"] + '/' + href["vid"] + '.html';
  592. } else {
  593. return location.protocol + '//v.qq.com/x/cover/' + href["cid"] + '.html';
  594. }
  595. } else if (href["vid"]) {
  596. return location.protocol + '//v.qq.com/x/page/' + href["vid"] + '.html';
  597. } else if (href["lid"]) {
  598. return location.protocol + '//v.qq.com/detail/' + href["lid"][0] + '/' + href["lid"] + '.html';
  599. } else {
  600. return null;
  601. }
  602. } else {
  603. return null;
  604. }
  605. });
  606. } else if (location.host.indexOf("iqiyi.com") !== -1) {
  607. ready(function () {
  608. readyPlayerBox("爱奇艺", ["div.m-iqyGuide-layer", "a[down-app-android-url]", "[name=m-extendBar]", "[class*=ChannelHomeBanner]", "section.m-hotWords-bottom"], settings.Default解析["爱奇艺"]["手机端"],
  609. "div.m-video-player-wrap", null)
  610. }, "complete");
  611. } else if (location.host.indexOf("youku.com") !== -1) {
  612. readyPlayerBox("优酷视频", ["#iframaWrapper", ".ad-banner-wrapper", ".h5-detail-guide,.h5-detail-vip-guide,[class$=ad],.Corner-container", "[data-spm='downloadApp'],.downloadApp", ".callEnd_box"],
  613. settings.Default解析["优酷视频"]["手机端"], "#player", null);
  614. } else if (location.host.indexOf("bilibili.com") !== -1) {
  615. readyPlayerBox("哔哩哔哩", ["div.fe-ui-open-app-btn,div.recom-wrapper,open-app-btn", "[class*=openapp]", "div.player-wrapper>div.player-mask.relative"], settings.Default解析["哔哩哔哩"]["手机端"],
  616. "div#app.main-container div.player-wrapper>div.player", null, function (href) {
  617. return href.replace("m.bilibili.com", "www.bilibili.com");
  618. });
  619. } else if (location.host.indexOf("miguvideo.com") !== -1) {
  620. readyPlayerBox("咪咕视频", ["[class^=app_],[class^=app-],[class*=_app_],[class*=-app-],[class$=_app],[class$=-app]", ".openClient", "div.group-item.programgroup .data-rate-01,div.group-item.programgroup .max-rate-01,div.group-item.programgroup .p-common"], settings.Default解析["咪咕视频"]["手机端"],
  621. "section#mod-player", null, function (href) {
  622. return href.replace("m.miguvideo.com", "www.miguvideo.com").replace("msite", "website");
  623. });
  624. } else if (location.host.indexOf("le.com") !== -1) {
  625. (function (block_show) {
  626. block_show.innerHTML = "div.layout{visibility: visible !important; display:block !important;}div.layout>*:not(style,script,#j-vote,#j-follow){visibility: visible !important; display: block !important;}";
  627. document.head.insertBefore(block_show, document.head.firstChild);
  628. })(document.createElement("style"));
  629. doElement("a.j-close-gdt", function (jump_over) {
  630. jump_over.click();
  631. return false;
  632. });
  633. readyPlayerBox("乐视TV", ["a.leapp_btn", "div.full_gdt_bits[id^=full][data-url]", "[class*=Daoliu],[class*=daoliu],[class*=game]", "div.m-start", "[class*=icon_user]"], settings.Default解析["乐视TV"]["手机端"],
  634. "div.column.play", null);
  635. } else if (location.host.indexOf("m.tv.sohu.com") !== -1) {
  636. readyPlayerBox("搜狐视频", ["div[class^=banner]", "div.js-oper-pos", "div[id^=ad],div[id^=ad] *", "[id*=login],[class*=login]", "[class$=-app]", "div.app-vbox.ph-vbox,div.app-vbox.app-guess-vbox", "div.twinfo_iconwrap", "div[class$=banner],div[id$=banner]"], settings.Default解析["搜狐视频"]["手机端"],
  637. "#player,#sohuplayer,.player-view", null, async function (href) {
  638. return await new Promise(function (resolve) {
  639. xmlHttpRequest({
  640. method: "GET",
  641. url: href, onload: function ({responseText}) {
  642. let result = responseText.match(new RegExp("var videoData = \{[^\x00]+tvUrl:\"(http.+)\",[\\r\\n]"))[1];
  643. resolve(result);
  644. }, error: function () {
  645. return resolve(href);
  646. }
  647. });
  648. });
  649. });
  650. } else if (location.host.indexOf("mgtv.com") !== -1) {
  651. readyPlayerBox("芒果TV", ["div.adFixedContain,div.ad-banner,div.m-list-graphicxcy.fstp-mark", "div[class^=mg-app],div#comment-id.video-comment div.ft,div.bd.clearfix,div.v-follower-info", "div.ht.mgui-btn.mgui-btn-nowelt", "div.personal", "div[data-v-41c9a64e]"], settings.Default解析["芒果TV"]["手机端"],
  652. "div.video-poster,div.video-area", null);
  653. } else if (location.host.indexOf("ixigua.com") !== -1) {
  654. readyPlayerBox("西瓜视频", ["div.xigua-download", "div.xigua-guide-button", "div.c-long-video-recommend.c-long-video-recommend-unfold"], settings.Default解析["西瓜视频"]["手机端"],
  655. "div.xigua-detailvideo-video", null);
  656. } else if (location.host.indexOf("pptv.com") !== -1) {
  657. readyPlayerBox("PPTV", ["[data-darkreader-inline-bgimage][data-darkreader-inline-bgcolor]", "div[class^=pp-m-diversion]", "section#ppmob-detail-picswiper", "section.layout.layout_ads", "div.foot_app", "div[modulename=导流位]", "a[class*=user]", "div.mod_video_info div.video_func"], settings.Default解析["PPTV"]["手机端"],
  658. "section.pp-details-video", null, function (href) {
  659. return href.replace("m.pptv.com", "v.pptv.com");
  660. });
  661. } else if (location.host.indexOf("vip.1905.com") !== -1) {
  662. (function (movie_info) {
  663. movie_info.innerHTML = "section#movie_info{padding-top: 20px !important;}";
  664. document.head.appendChild(movie_info);
  665. })(document.createElement("style"));
  666. readyPlayerBox("1905电影网", ["a.new_downLoad[target=_blank]", "iframe[srcdoc^='<img src=']", "section.movieList_new.club_new", ".wakeAppBtn", "[class*=login]", "section.openMembershipBtn", ".ad", ".open-app,.openApp,ul.iconList li:not(.introduceWrap),div#zhichiBtnBox", "section#hot_movie,section#exclusive_movie,section#hot_telve"], settings.Default解析["1905电影网"]["手机端"],
  667. "div.area.areaShow.clearfix_smile", null);
  668. } else if (location.host.indexOf("www.wasu.cn") !== -1) {
  669. readyPlayerBox("华数TV", ["div.ws_poster", "div.appdown,div.player_menu_con", "div#play_and_info_fix_adv"], settings.Default解析["华数TV"]["手机端"],
  670. "div#player,div#pop", null);
  671. }
  672. }
  673.  
  674. function readyPlayerBox(Tip, displayNones, srcs, cssString, doFunction, doHref = null) {
  675. const SRCS = srcs;
  676. if (Tip) {
  677. console.log("%c已进入" + Tip, settings.fontStyle.max);
  678. }
  679. let others;
  680. location.onchange = function () {
  681. srcs = SRCS;
  682. others = Object.values(settings.NoAD解析).filter(function (value) {
  683. // 求出 srcs 在 NoAD解析 中的补集
  684. return srcs.indexOf(value) === -1;
  685. });
  686. // noinspection SillyAssignmentJS 调用的是set和get方法
  687. settings.src = settings.src;
  688. }; // TODO ,监听url变化,如果网页rul变了就解析新地址
  689.  
  690. if (displayNones) {
  691. displayNone(displayNones);
  692. }
  693. doElement(cssString, function (playerBox) {
  694. if (playerBox.style.display === "none") {
  695. playerBox.style.display = "";
  696. }
  697.  
  698. let iframe = document.createElement("iframe");
  699. iframe.allowFullscreen = true;
  700. iframe.importance = "high"; // auto (default) 不指定优先级。浏览器根据自身情况决定资源的加载顺序 high 资源的加载优先级较高 low 资源的加载优先级较低
  701. iframe.frameBorder = "0"; // HTML5已弃用此属性,并使用style.border代替
  702. iframe.scrolling = "no";
  703. iframe.width = "100%";
  704. iframe.height = "100%";
  705. const iframe_style = "background-color: #000 !important; border: 0 !important; display: block !important; visibility: visible !important; opacity: 1 !important; min-width: 100% !important; width: 100% !important; max-width: 100% !important; min-height: 100% !important; height: 100% !important; max-height: 100% !important; position: absolute !important; left: 0px !important; top: 0px !important; z-index: 2147483647 !important; overflow: hidden !important;";
  706. iframe.setAttribute("style", iframe_style);
  707. iframe.onload = function () {
  708. if (iframe.contentWindow.length === 0 && settings.address.length === 0) {
  709. settings.randomSeleceParse("解析已失效,正在切换解析源");
  710. }
  711. };
  712.  
  713. others = Object.values(settings.NoAD解析).filter(function (value) {
  714. // 求出 srcs 在 NoAD解析 中的补集
  715. return srcs.indexOf(value) === -1;
  716. });
  717.  
  718. (function (DIY_iframe_select) {
  719. DIY_iframe_select.setAttribute("style", "border: 0; background-color: #ddd; text-align: center; width: 80px; height: 100%; border-bottom-left-radius: 15px; border-top-left-radius: 15px;");
  720. try {
  721. let src = "";
  722. Object.defineProperty(settings, "src", {
  723. enumerable: true,
  724. configurable: false,
  725. get: function () {
  726. return src;
  727. },
  728. set: function (value) {
  729. if (!value) return false;
  730. src = DIY_iframe_select.value = value;
  731. srcs.pull(value);
  732. settings.address = [];
  733. // const newiframe = document.querySelector("iframe[id*=player]");
  734. // if (newiframe) iframe = newiframe;
  735. if (typeof doHref === "function") {
  736. let href = doHref(location.href);
  737. iframe.src = value ? value + (href ? href : location.href) : "";
  738. } else {
  739. iframe.src = value ? value + location.href : "";
  740. }
  741. return true;
  742. }
  743. });
  744. } catch (e) {
  745. console.error(e.message);
  746. }
  747.  
  748. for (let name in settings.NoAD解析) {
  749. DIY_iframe_select.innerHTML += "<option value='" + settings.NoAD解析[name] + "' style='text-align: center'>" + name + "</option>";
  750. }
  751. for (let name in settings.AD解析) {
  752. DIY_iframe_select.innerHTML += "<option value='" + settings.AD解析[name] + "' style='text-align: center; color: #fa0; '>⚠" + name + "</option>";
  753. }
  754. DIY_iframe_select.addEventListener("change", function (event) {
  755. settings.src = DIY_iframe_select.value;
  756. if (event.isTrusted) {
  757. // 预先设置历史解析源(用于适配不支持iframe执行脚本的浏览器)
  758. localStorage.setItem('parse.historyParse', settings.src);
  759. }
  760. });
  761.  
  762. settings.randomSeleceParse = function (message) {
  763. // arguments 代表输入的所有参数,看不懂可以百度搜索 “js 参数 arguments”
  764. // return arguments ? arguments[Math.floor(Math.random() * arguments.length)] : null;
  765. if (srcs.length > 0) {
  766. showTip(message ? message : "解析失败,正在切换解析源");
  767. let random = Math.floor(Math.random() * srcs.length);
  768. settings.src = srcs.splice(random, 1)[0];
  769. } else if (others) {
  770. showTip(message ? message : "解析失败,正在尝试其他解析源");
  771. srcs = others;
  772. others = null;
  773. let random = Math.floor(Math.random() * srcs.length);
  774. settings.src = srcs.splice(random, 1)[0];
  775. } else {
  776. showTip("该视频可能无法解析\n请尝试使用⚠广告解析\n如有疑问请反馈");
  777. return false;
  778. }
  779. return true;
  780. };
  781.  
  782. (function () {
  783. const DIY_iframe_button = settings.toolsBar.querySelector("button");
  784. settings.DIY_iframeFunction = function () {
  785. if (settings.parseDB.DIY解析栏 && DIY_iframe_select.style.display === "none") {
  786. DIY_iframe_select.style.display = DIY_iframe_select.style.visibility = "";
  787. DIY_iframe_button.style.borderRadius = "0px 15px 15px 0px";
  788. } else if (!settings.parseDB.DIY解析栏 && DIY_iframe_select.style.display !== "none") {
  789. DIY_iframe_select.style.display = "none";
  790. DIY_iframe_select.style.visibility = "hidden";
  791. DIY_iframe_button.style.borderRadius = "15px";
  792. }
  793. }
  794. settings.DIY_iframeFunction();
  795. const toolsBarSettings = settings.toolsBar.querySelector("settings");
  796. toolsBarSettings.insertBefore(DIY_iframe_select, toolsBarSettings.firstChild);
  797. })();
  798. })(document.createElement("select"));
  799.  
  800. // 获取历史解析
  801. settings.src = localStorage.getItem("parse.historyParse");
  802. if (!settings.src) {
  803. settings.randomSeleceParse("正在引入解析源");
  804. }
  805. playerBox.style.zIndex = "1";
  806. playerBox.appendChild(iframe);
  807. console.log("%cplayerBox已建立解析连接", settings.fontStyle.max);
  808.  
  809. setInterval(function () {
  810. let newPlayerBox = document.querySelector(cssString);
  811. if (newPlayerBox !== null && (newPlayerBox !== playerBox || newPlayerBox.querySelector("iframe[src='" + iframe.src + "']") === null)) {
  812. console.log("playerBox重新建立连接");
  813. let src = iframe.src;
  814. iframe.src = "";
  815. iframe = iframe.cloneNode(true);
  816. iframe.src = src;
  817. newPlayerBox.style.zIndex = "1";
  818. newPlayerBox.appendChild(iframe);
  819. }
  820. }, settings.getElementTimes);
  821.  
  822. function closeOldMedia() {
  823. Object.getOwnPropertyNames(top).forEach(function (property) {
  824. if (typeof window[property] === "function" && Boolean(window[property].prototype) && typeof window[property].prototype.addSourceBuffer === "function") {
  825. const $addSourceBuffer = window[property].prototype.addSourceBuffer;
  826. window[property].prototype.addSourceBuffer = function addSourceBuffer(mime) {
  827. if (window === top) {
  828. this.removeSourceBuffer($addSourceBuffer.call(this, mime));
  829. return null;
  830. } else {
  831. return $addSourceBuffer.call(this, mime);
  832. }
  833. };
  834. }
  835. });
  836. for (const node of playerBox.querySelectorAll("*")) {
  837. if (node !== iframe) {
  838. node.addEventListener("loadeddata", function () {
  839. node.src = URL.createObjectURL(new Blob(new Array(0)));
  840. }, true);
  841. node.src = URL.createObjectURL(new Blob(new Array(0)));
  842. node.remove();
  843. }
  844. }
  845. }
  846.  
  847. closeOldMedia();
  848. if (document.readyState.toLowerCase() != "complete") ready(closeOldMedia, "complete");
  849.  
  850. if (doFunction) {
  851. doFunction(playerBox, iframe);
  852. }
  853.  
  854. setInterval(function () {
  855. for (let other_iframe of document.querySelectorAll("iframe")) {
  856. if (other_iframe.src !== iframe.src || other_iframe.constructor.name !== iframe.constructor.name) {
  857. other_iframe.remove();
  858. }
  859. }
  860. if (iframe.getAttribute("style") !== iframe_style) {
  861. iframe.setAttribute("style", iframe_style);
  862. }
  863. }, settings.getElementTimes);
  864.  
  865. ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange'].forEach(function (item) {
  866. window.addEventListener(item, function () {
  867. if (document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen) {
  868. settings.toolsBar.style.display = 'none';
  869. } else {
  870. settings.toolsBar.style.display = 'block';
  871. }
  872. }, true);
  873. });
  874. });
  875. }
  876. } else {
  877. console.log(location.href + " 1ok");
  878.  
  879. function setParseVideo() {
  880. console.log(location.href + " 2ok");
  881. forElements("video", async function (videos, thisInterval) {
  882. for (const video of videos) {
  883. if (video.poster) video.removeAttribute("poster");
  884. if (video.src && video.duration > 7) {
  885. // 清除监听video计时器
  886. clearInterval(thisInterval);
  887. // console.log("解析成功,清空解析列表缓存");
  888.  
  889. top.postMessage(settings.key.encrypt("宝塔镇河妖\x00给予\x001"), "*");
  890. top.postMessage(settings.key.encrypt("宝塔镇河妖\x00按下Enter获取焦点"), "*");
  891.  
  892. // console.log("移除广告模块");
  893. removeElements(['document.getElementById("ADplayer")', 'document.getElementById("ADtip")']);
  894. // console.log("等待数据得到响应,移除弹幕模块");
  895. settings.parseDB = await settings.parseDB;
  896. if (!settings.parseDB.弹幕开关) {
  897. // console.log("正在移除弹幕功能");
  898. removeElements(['document.querySelector("div[class$=player-video-wrap]").getElementsByTagName("div")', 'document.querySelector("div[class$=player-danmu]")', 'document.querySelector("div[class$=player-danmaku]")', 'document.querySelector("div[class*=player-comment-box]")', 'document.querySelector("div[class*=player-controller-mask]")', 'document.querySelector("[class*=player-list-icon]")', 'document.querySelector("div[class$=player-menu]")']);
  899. }
  900. (function () {
  901. video.loop = false;
  902. video.autopictureinpicture = true;
  903. const playbackRate = localStorage.getItem("parse.playbackRate");
  904. if (playbackRate) {
  905. video.playbackRate = parseFloat(playbackRate);
  906. const playbackRateElement = document.querySelector("[class*=speeds] [class*=layer-label].title");
  907. if (video.playbackRate !== 1 && playbackRateElement !== null) playbackRateElement.innerText = playbackRate + "x";
  908. }
  909. video.addEventListener("ratechange", function () {
  910. localStorage.setItem("parse.playbackRate", video.playbackRate.toString());
  911. });
  912. })();
  913.  
  914. // console.log("进入/退出 全屏");
  915. const openFullscreen = HTMLVideoElement.prototype.RequestFullScreen ? HTMLVideoElement.prototype.RequestFullScreen : //兼容Firefox
  916. HTMLVideoElement.prototype.mozRequestFullScreen ? HTMLVideoElement.prototype.mozRequestFullScreen ://兼容Chrome, Safari and Opera等
  917. HTMLVideoElement.prototype.webkitRequestFullScreen ? HTMLVideoElement.prototype.webkitRequestFullScreen : //兼容IE/Edge
  918. HTMLVideoElement.prototype.msRequestFullscreen;
  919. const exitFullscreen = document.exitFullScreen ? document.exitFullScreen : //兼容Firefox
  920. document.mozCancelFullScreen ? document.mozCancelFullScreen : //兼容Chrome, Safari and Opera等
  921. document.webkitExitFullscreen ? document.webkitExitFullscreen : //兼容IE/Edge
  922. document.body.msExitFullscreen;
  923. const getFullscreenElement = typeof document.fullscreenElement !== "undefined" ? function () {
  924. return document.fullscreenElement;
  925. } : typeof document.mozFullScreenElement !== "undefined" ? function () {
  926. return document.mozFullScreenElement;
  927. } : typeof document.msFullScreenElement !== "undefined" ? function () {
  928. return document.msFullScreenElement;
  929. } : function () {
  930. return document.webkitFullscreenElement;
  931. };
  932. let fullscreen = (function (node) {
  933. return function (value) {
  934. if (typeof value === "undefined" ?
  935. Boolean(getFullscreenElement()) : !value) {
  936. exitFullscreen.apply(document);
  937. } else {
  938. openFullscreen.apply(node);
  939. }
  940. video.focus();
  941. };
  942. })(isMobile ? video : document.body);
  943. video.addEventListener("pause", function () {
  944. if ((video.currentTime - video.duration) > -5) {
  945. // console.log("视频播放结束了");
  946. fullscreen(false);
  947. }
  948. });
  949.  
  950. if (!isMobile) {
  951. (function () {
  952. const fullscreen_btn = document.querySelector("[class*=fullscreen][class*=On],[class$=player-full] button[class$=full-icon]");
  953. if (fullscreen_btn && fullscreen_btn.nodeType === 1) {
  954. fullscreen = function (value) {
  955. if (typeof value === "undefined") {
  956. fullscreen_btn.click();
  957. } else if (value && !Boolean(getFullscreenElement())) {
  958. fullscreen_btn.click();
  959. } else if (!value && Boolean(getFullscreenElement())) {
  960. fullscreen_btn.click();
  961. }
  962. };
  963. }
  964. })();
  965. (function (isFullscreen) {
  966. window.addEventListener("keydown", function (event) {
  967. if (event.key === "Enter") {
  968. isFullscreen = Boolean(getFullscreenElement());
  969. }
  970. }, true);
  971. window.addEventListener("keyup", function (event) {
  972. if (event.key === "Enter") {
  973. if (isFullscreen === Boolean(getFullscreenElement())) {
  974. fullscreen();
  975. if (video.paused) {
  976. video.play();
  977. }
  978. }
  979. }
  980. }, false);
  981. })();
  982. showTip("回车,进入全屏播放");
  983. } else {
  984. showTip("解析成功");
  985. }
  986.  
  987. fullscreen(settings.parseDB.自动全屏);
  988. if (video.paused) {
  989. video.play();
  990. }
  991. }
  992. }
  993. }, 5000, function () {
  994. console.log(location.href + " 3ok");
  995. top.postMessage(settings.key.encrypt("宝塔镇河妖\x00给予\x00-1\x00" + location.href), "*");
  996. });
  997. }
  998.  
  999. if (location.host.indexOf("jiexi.t7g.cn") !== -1) {
  1000. // 移除爱解析p2p提示
  1001. displayNone(["body>div#stats"]);
  1002. setParseVideo();
  1003. } else if (location.host.indexOf("api.okjx.cc:3389") !== -1) {
  1004. // 删除OK解析线路选择功能
  1005. (function (style) {
  1006. style.innerHTML = ".slide,.panel,.slide *,.panel *{width: 0 !important; max-width: 0 !important; opacity: 0 !important;}";
  1007. document.head.appendChild(style);
  1008. })(document.createElement("style"));
  1009. setParseVideo();
  1010. } else if (location.host.indexOf("api.jiubojx.com") !== -1) {
  1011. displayNone("div.adv_wrap_hh");
  1012. setParseVideo();
  1013. } else if (location.host.indexOf("yemu.xyz") !== -1) {
  1014. if (location.pathname.indexOf("jx.php") === -1) {
  1015. if (location.host.indexOf("www.yemu.xyz") !== -1) {
  1016. // 删除夜幕解析线路选择功能
  1017. (function (style) {
  1018. style.innerHTML = ".slide,.panel,.slide *,.panel *{width: 0 !important; max-width: 0 !important; opacity: 0 !important;}";
  1019. document.head.appendChild(style);
  1020. })(document.createElement("style"));
  1021. } else if (location.host.indexOf("jx.yemu.xyz") !== -1) {
  1022. // 移除视频分类提示 及 解析框架处理
  1023. displayNone(["div.advisory"]);
  1024. setParseVideo();
  1025. }
  1026. } else {
  1027. // 移除背景图片
  1028. doElement("div[style*='width:100%;height:100%;'][style*='.jpg']", function (background) {
  1029. background.setAttribute("style", "width:100%; height:100%; position:relative; z-index:2147483647987;");
  1030. }, 5000);
  1031. }
  1032. } else if (location.host.indexOf('www.mtosz.com') !== -1) {
  1033. displayNone([".video-panel-blur-image"]); // 似乎不管用?
  1034. doElement(".video-panel-blur-image", function (element) {
  1035. element.setAttribute("style", "display: none; height: 0; width: 0;");
  1036. });
  1037. setParseVideo();
  1038. } else if (location.host.indexOf('v.superchen.top:3389') !== -1) {
  1039. setParseVideo();
  1040. } else if (location.host.indexOf('jx.parwix.com:4433') !== -1) {
  1041. setParseVideo();
  1042. } else {
  1043. setParseVideo();
  1044. }
  1045. }
  1046.  
  1047. function displayNone(Tags) {
  1048. setTimeout(function () {
  1049. let style = document.createElement("style");
  1050. style.innerHTML = "\n";
  1051. for (let i = 0; i < Tags.length; i++) {
  1052. style.innerHTML += Tags[i] + "{display: none !important; height: 0 !important; width: 0 !important; visibility: hidden !important; max-height: 0 !important; max-width: 0 !important; opacity: 0 !important;}\n";
  1053. }
  1054. document.head.insertBefore(style, document.head.firstChild);
  1055. });
  1056. }
  1057. }
  1058.  
  1059. function showTip(msg, style = "") {
  1060. try {
  1061. // 该函数需要在top内运行,否则可能显示异常
  1062. if (window === top) {
  1063. let tip = document.querySelector(":root>tip");
  1064. if (tip && tip.nodeType === 1) {
  1065. // 防止中途新的showTip事件创建多个tip造成卡顿
  1066. tip.remove();
  1067. }
  1068. tip = document.createElement("tip");
  1069. // pointer-events: none; 禁用鼠标事件,input标签使用 disabled='disabled' 禁用input标签
  1070. tip.setAttribute("style", style + "pointer-events: none; opacity: 0; background-color: #222a; color: #fff; font-family: 微软雅黑,黑体,Droid Serif,Arial,sans-serif; font-size: 20px; text-align: center; padding: 6px; border-radius: 16px; position: fixed; transform: translate(-50%, -50%); left: 50%; bottom: 15%; z-index: 2147483647;");
  1071. tip.innerHTML = "<style>@keyframes showTip {0%{opacity: 0;} 33.34%{opacity: 1;} 66.67%{opacity: 1;} 100%{opacity: 0;}}</style>\n" + msg;
  1072. let time = msg.replace(new RegExp("\\s"), "").length / 2; // TODO 2个字/秒
  1073. // cubic-bezier(起始点, 起始点偏移量, 结束点偏移量, 结束点),这里的 cubic-bezier函数 表示动画速度的变化规律
  1074. tip.style.animation = "showTip " + (time > 2 ? time : 2) + "s cubic-bezier(0," + ((time - 1) > 0 ? (time - 1) / time : 0) + "," + (1 - ((time - 1) > 0 ? (time - 1) / time : 0)) + ",1) 1 normal";
  1075. document.root.appendChild(tip);
  1076. setTimeout(function () {
  1077. try {
  1078. tip.remove();
  1079. } catch (e) {
  1080. // 排除root没有找到tip
  1081. }
  1082. }, time * 1000);
  1083. } else {
  1084. top.postMessage(settings.key.encrypt("宝塔镇河妖\x00函数\x00showTip('" + msg + "')"), "*");
  1085. }
  1086. } catch (e) {
  1087. console.log(msg);
  1088. }
  1089. }
  1090. })();
  1091.  
  1092. function require(url) {
  1093. const request = new XMLHttpRequest();
  1094. let result;
  1095. request.open("GET", url, false);
  1096. request.onload = function () {
  1097. result = eval(request.response);
  1098. console.log("use-scrypt.length = " + request.response.length);
  1099. };
  1100. request.send();
  1101. return result;
  1102. }
  1103. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址