ddrkhelper低端影视助手

去除低端影视广告, 一键获取视频直链和字幕直链

  1. // ==UserScript==
  2. // @name ddrkhelper低端影视助手
  3. // @namespace https://gf.qytechs.cn/zh-CN/users/547075-limkim
  4. // @version 1.3.0
  5. // @license MIT
  6. // @description 去除低端影视广告, 一键获取视频直链和字幕直链
  7. // @author limkim
  8. // @match https://ddrk.me/*
  9. // @match https://ddys.tv/*
  10. // @match https://ddys.pro/*
  11. // @match https://ddys2.me/*
  12. // @match https://ddys.art/*
  13.  
  14. // @icon https://gf.qytechs.cn/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MTQyMzM2LCJwdXIiOiJibG9iX2lkIn19--d46c889cb90bcdda22c3de1e78dd1e4b71e9a8bf/Untitled2.png?locale=zh-CN
  15. // @run-at document-end
  16. // @grant unsafeWindow
  17. // @grant GM_addStyle
  18. // @grant GM_getValue
  19. // @grant GM_setValue
  20. // @grant GM_deleteValue
  21. // @grant GM_listValues
  22. // @grant GM_openInTab
  23. // @grant GM_notification
  24. // @grant GM_xmlhttpRequest
  25. // ==/UserScript==
  26.  
  27. (function () {
  28. 'use strict';
  29. // 间隔200ms去广告
  30. let retryCount = 0;
  31. let ad_id = null;
  32. const timer = setInterval(() => {
  33. if (retryCount === 5) {
  34. clearInterval(timer);
  35. }
  36. retryCount++;
  37. if (document.querySelector("#notification-1501")) {
  38. document.querySelector("#notification-1501").remove();
  39. document.body.style.paddingTop = 0;
  40. }
  41. const main = document.querySelector("#main");
  42. if (main.querySelector("div").nextElementSibling.nodeName === "BR") {
  43. main.querySelector("div").remove();
  44. }
  45. const entry = document.querySelector(".entry");
  46. if (entry && entry.querySelector("div").nextElementSibling.nodeName === "BR") {
  47. entry.querySelector("div").innerHTML = "";
  48. ad_id = entry.querySelector("div").id;
  49. }
  50. if (document.querySelector(".cfa_popup")) {
  51. document.querySelector(".cfa_popup").remove();
  52. }
  53. }, 200);
  54.  
  55. // 字幕与视频部分
  56. const container = document.getElementsByClassName("wp-playlist wp-video-playlist")[0];
  57. if (!container) { return; }
  58. // 视频信息列表
  59. const list = JSON.parse(document.querySelector(".wp-playlist-script").innerText);
  60. console.clear();
  61. console.log('playlist: ', list);
  62.  
  63. const origin = window.location.origin;
  64. // 视频链接请求主体
  65. const fetchVideoUrl = (track) => new Promise(async (resolve, reject) => {
  66. // 拼凑字幕链接
  67. const ddrUrl = `${origin}/subddr${track.subsrc}`;
  68. let videoUrl = '';
  69. if (!track.src1) {
  70. videoUrl = `https://v.ddys.pro${track.src0}`;
  71. } else {
  72. const res = await fetch(`${origin}/getvddr3/video?id=${track.src1}&type=json`);
  73. const json = await res.json();
  74. videoUrl = json.url || `https://v.ddys.pro${track.src0}`;
  75. console.log('fetch succeed: ', json);
  76. }
  77. // 生成下载控件
  78. const html = `${track.caption} <a target='_blank' href='${ddrUrl}'>字幕下载</a>
  79. <span style="cursor: pointer;" onclick="navigator.clipboard.writeText('${ddrUrl}')">复制字幕链接</span>
  80. <span style="cursor: pointer;" onclick="navigator.clipboard.writeText('${videoUrl}')">复制视频链接</span> <br>`;
  81. const result = {
  82. html,
  83. video: videoUrl,
  84. sub: ddrUrl
  85. };
  86. console.log('finished: ', result);
  87. resolve(result);
  88. });
  89.  
  90.  
  91. const currentButton = document.createElement("button");
  92. currentButton.innerText = "查看当前视频和字幕原址";
  93. container.style.position = "relative";
  94. currentButton.style.position = "absolute";
  95. currentButton.style.top = "50px";
  96. currentButton.style.right = "-190px";
  97. container.appendChild(currentButton);
  98. currentButton.addEventListener("click", async () => {
  99. // 获取当前集数
  100. const search = window.location.search || '?ep=1';
  101. const index = parseInt(search.split('?ep=')[1].split('&')[0]) - 1;
  102. const track = list.tracks[index];
  103. const { html } = await fetchVideoUrl(track);
  104. document.querySelector("#" + ad_id).innerHTML = html;
  105. });
  106.  
  107. const allButton = document.createElement("button");
  108. allButton.innerText = "查看所有";
  109. allButton.style.position = "absolute";
  110. allButton.style.top = "80px";
  111. allButton.style.right = "-92px";
  112. container.appendChild(allButton);
  113. allButton.addEventListener("click", () => {
  114. let htmlToRender = "";
  115. // 循环请求每一集
  116. list.tracks.forEach(async track => {
  117. const { html } = await fetchVideoUrl(track);
  118. htmlToRender += html;
  119. document.querySelector("#" + ad_id).innerHTML = htmlToRender;
  120. });
  121. });
  122. })();

QingJ © 2025

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