Phim4400 Helper

Xem online và tải phim trực tiếp tại Phim4400, bỏ qua quảng cáo.

  1. // ==UserScript==
  2. // @name Phim4400 Helper
  3. // @name:vi Phim4400 Helper
  4. // @namespace https://lelinhtinh.github.io
  5. // @description Xem online và tải phim trực tiếp tại Phim4400, bỏ qua quảng cáo.
  6. // @description:vi Xem online và tải phim trực tiếp tại Phim4400, bỏ qua quảng cáo.
  7. // @version 1.3.0
  8. // @icon https://i.imgur.com/wRRkkqr.png
  9. // @author lelinhtinh
  10. // @oujs:author baivong
  11. // @license MIT; https://baivong.mit-license.org/license.txt
  12. // @match https://phim440.cf/*
  13. // @match https://phim4400.cf/*
  14. // @match https://phim4400.tv/*
  15. // @require https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.9.0/sha256.min.js
  16. // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js?v=a834d46
  17. // @noframes
  18. // @supportURL https://github.com/lelinhtinh/Userscript/issues
  19. // @run-at document-idle
  20. // @grant GM.xmlHttpRequest
  21. // @grant GM_xmlhttpRequest
  22. // ==/UserScript==
  23.  
  24. /* global shortcut, sha256 */
  25. (function () {
  26. 'use strict';
  27.  
  28. document.oncontextmenu = null;
  29. if (shortcut) {
  30. shortcut.remove('Ctrl+U');
  31. shortcut.remove('F12');
  32. shortcut.remove('Ctrl+Shift+I');
  33. shortcut.remove('Ctrl+S');
  34. shortcut.remove('Ctrl+Shift+C');
  35. }
  36.  
  37. if (location.pathname.indexOf('/phim/') === -1) {
  38. let $btn = document.querySelector('.button-phim'),
  39. link = $btn.search;
  40.  
  41. if (!link) return;
  42. link = new URLSearchParams(link);
  43. if (!link.has('url')) return;
  44. link = atob(link.get('url'));
  45. if (link.indexOf('/phim/') === -1) return;
  46.  
  47. if ($btn === null) {
  48. $btn = document.createElement('a');
  49. $btn.textContent = 'Xem Online và Tải Phim';
  50. document.querySelector('.button-info').appendChild($btn);
  51. }
  52.  
  53. $btn.className = 'button-phim uk-button uk-button-default uk-dropdown-right';
  54. $btn.setAttribute('target', '_top');
  55.  
  56. $btn.href = link;
  57. return;
  58. }
  59.  
  60. const $videoWrap = document.querySelector('.xem-phim');
  61. if ($videoWrap.innerHTML.trim() !== '') return;
  62.  
  63. function renderVideo(src) {
  64. let $video = document.querySelector('#vipPlayer');
  65.  
  66. if ($video === null) {
  67. $video = document.createElement('video');
  68. $video.id = 'vipPlayer';
  69. $video.controls = true;
  70. $video.preload = 'auto';
  71. $video.setAttribute(
  72. 'style',
  73. `
  74. height: 450px;
  75. width: 100%;
  76. `
  77. );
  78. $video.addEventListener('error', () => {
  79. $content.innerHTML = `
  80. <p class="uk-text-center uk-card-body">
  81. <em>
  82. <big>Không th phát video lúc này!</big>
  83. <br>
  84. <span>Hãy th chuyn sang server khác.</span>
  85. </em>
  86. </p>
  87. `;
  88. });
  89.  
  90. $content.innerHTML = '';
  91. $content.appendChild($video);
  92. }
  93.  
  94. $video.src = src;
  95. $video.play();
  96. }
  97.  
  98. function getVideo(host) {
  99. if (hostConfigs[host].src) {
  100. const $aActive = $tabs.querySelector('li.uk-active a');
  101. if ($aActive !== null && $aActive.dataset.host === host) return;
  102.  
  103. renderVideo(hostConfigs[host].src);
  104. return;
  105. }
  106.  
  107. if (host === 'upfileVn') {
  108. hostConfigs.upfileVn.data =
  109. 'Token=' + sha256(hostConfigs.upfileVn.href.split('://')[1].split('/')[1] + '7891').toUpperCase();
  110. }
  111.  
  112. GM.xmlHttpRequest({
  113. url: hostConfigs[host].href,
  114. method: hostConfigs[host].method || 'POST',
  115. headers: hostConfigs[host].headers,
  116. data: hostConfigs[host].data,
  117.  
  118. onload: (response) => {
  119. let src = hostConfigs[host].getSrc(response.response);
  120. hostConfigs[host].src = src;
  121. renderVideo(src);
  122. },
  123. });
  124. }
  125.  
  126. function playVideo(e) {
  127. e.preventDefault();
  128. e.stopPropagation();
  129.  
  130. const $this = e.target,
  131. $active = $tabs.querySelector('li.uk-active');
  132.  
  133. getVideo($this.dataset.host);
  134.  
  135. if ($active !== null) $active.classList.remove('uk-active');
  136. $this.parentNode.classList.add('uk-active');
  137. }
  138.  
  139. const hostConfigs = {
  140. upfileVn: {
  141. selector: 'a[href*="upfile.vn"]',
  142. headers: {
  143. 'Content-Type': 'application/x-www-form-urlencoded',
  144. },
  145. getSrc: (response) => {
  146. return JSON.parse(response).Link;
  147. },
  148. },
  149. drivehub: {
  150. selector: 'a[href*="drivehub.link"]',
  151. method: 'GET',
  152. getSrc: (response) => {
  153. const parser = new DOMParser();
  154. const $html = parser.parseFromString(response, 'text/html');
  155. const $proceed = $html.querySelector('#proceed');
  156.  
  157. return $proceed === null ? null : $proceed.href.replace(/\?e=download$/, '');
  158. },
  159. },
  160. upfileUs: {
  161. selector: 'a[href*="upfile.us"]',
  162. headers: {
  163. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
  164. 'X-Requested-With': 'XMLHttpRequest',
  165. },
  166. data: 'type=file_check',
  167. getSrc: (response) => {
  168. return JSON.parse(response).debug[0].file_source;
  169. },
  170. },
  171. };
  172.  
  173. const $tabs = document.createElement('ul');
  174. $tabs.className = 'uk-subnav uk-subnav-pill';
  175.  
  176. let hostCount = 0;
  177. Object.keys(hostConfigs).forEach((host) => {
  178. const currHost = hostConfigs[host];
  179. const $btn = document.querySelector('.uk-accordion-content ' + currHost.selector);
  180. if ($btn === null) return;
  181. hostConfigs[host].href = $btn.href;
  182.  
  183. const li = document.createElement('li');
  184. const a = document.createElement('a');
  185.  
  186. a.textContent = 'Server ' + ++hostCount;
  187. a.href = '#' + host;
  188. a.setAttribute('data-host', host);
  189. a.addEventListener('click', playVideo);
  190.  
  191. li.appendChild(a);
  192. $tabs.appendChild(li);
  193. });
  194.  
  195. const $contents = document.createElement('ul');
  196. $contents.className = 'uk-switcher uk-margin';
  197.  
  198. const $content = document.createElement('li');
  199. $content.className = 'uk-active';
  200. $content.setAttribute(
  201. 'style',
  202. `
  203. background: #000;
  204. border: 1px solid #6fb429;
  205. border-top: 0px solid #0000;
  206. box-sizing: border-box;
  207. `
  208. );
  209. $contents.appendChild($content);
  210.  
  211. $videoWrap.appendChild($tabs);
  212. $videoWrap.appendChild($contents);
  213.  
  214. $tabs.querySelector('a').click();
  215. })();

QingJ © 2025

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