Greasy Fork is available in English.

ddrk-download

低端影视-下载

  1. // ==UserScript==
  2. // @name ddrk-download
  3. // @namespace https://github.com/Mrbunker/ddrk-download
  4. // @version 0.0.2
  5. // @author mission522
  6. // @description 低端影视-下载
  7. // @license MIT
  8. // @icon https://ddys.art/favicon-32x32.png
  9. // @match *://*.ddys.tv/*
  10. // @match *://*.ddys.art/*
  11. // @match *://*.ddys.pro/*
  12. // @match *://*.ddys2.me/*
  13. // @match *://*.ddys.me/*
  14. // ==/UserScript==
  15.  
  16. (d=>{const o=document.createElement("style");o.dataset.source="vite-plugin-monkey",o.innerText=d,document.head.appendChild(o)})(".ddd-btn{color:#fff;padding:0 15px;cursor:pointer;color:#00b09a}.ddd-btn:hover{color:#006457;text-decoration:underline}.ddd-popup{min-width:100px;min-height:100px;padding:20px;border-radius:20px 0 0;box-shadow:#848484 -1px -1px 8px;background-color:#fff;z-index:998;position:fixed;bottom:0;right:0;transition:all}#afc_sidebar_2842,#iaujwnefhw,#sajdhfbjwhe{position:fixed!important;right:20000px!important}");
  17.  
  18. (function() {
  19. "use strict";
  20. const style = "";
  21. async function main() {
  22. var _a;
  23. const wpScript = (_a = document.querySelector("script.wp-playlist-script")) == null ? void 0 : _a.innerHTML;
  24. if (!wpScript)
  25. return;
  26. const popup = createPopup();
  27. createBtn(popup, wpScript);
  28. }
  29. function createPopup() {
  30. const popup = document.createElement("div");
  31. document.body.appendChild(popup);
  32. popup.classList.add("ddd-popup");
  33. popup.style.display = "none";
  34. return popup;
  35. }
  36. function createBtn(popup, wpScript) {
  37. const app = document.createElement("span");
  38. app.classList.add("ddd-btn");
  39. app.innerHTML = "下载";
  40. let firtClick = true;
  41. app.addEventListener("click", async () => {
  42. popup.style.display = popup.style.display === "none" ? "block" : "none";
  43. if (!firtClick)
  44. return;
  45. const data = await download(wpScript);
  46. const popupStr = data.map(
  47. (item) => `<div><span>${item == null ? void 0 : item.ep}</span> <a href="${(item == null ? void 0 : item.video) ? item == null ? void 0 : item.video : "无"}" >链接</a></div>`
  48. ).join("");
  49. popup.innerHTML = popupStr;
  50. firtClick = false;
  51. });
  52. const appWrap = document.querySelector(`.entry>p [style="float:right;"]:not([class])`);
  53. appWrap.innerHTML = "";
  54. appWrap == null ? void 0 : appWrap.appendChild(app);
  55. }
  56. async function download(wpScript) {
  57. const tracks = JSON.parse(wpScript).tracks;
  58. const resources = tracks.map((item) => {
  59. const regResult = item.src0.match(/^\/v\/((\w*)\/(.*))/);
  60. return {
  61. name: regResult ? regResult[1] : "匹配失败",
  62. ep: item.caption,
  63. catalog: regResult ? regResult[2] : "匹配失败",
  64. src1: `${window.location.origin}/getvddr/video?id=${item.src1}&type=mix`
  65. };
  66. });
  67. return await Promise.all(
  68. resources.map(async (item) => {
  69. const res = await fetch(item.src1);
  70. const resJson = await res.json();
  71. const video = (resJson == null ? void 0 : resJson.url) ? resJson == null ? void 0 : resJson.url.replace("=1", item.name) : void 0;
  72. return {
  73. name: item.name,
  74. ep: item.ep,
  75. catalog: item.catalog,
  76. video,
  77. cache: resJson == null ? void 0 : resJson.cache
  78. };
  79. })
  80. );
  81. }
  82. main();
  83. })();