Greasy Fork

Greasy Fork is available in English.

🎬追剧系列--全网VIP视频破解(精简版)

全网VIP视频解析 - 目前支持腾讯、爱奇艺、优酷、芒果TV、B站

当前为 2024-08-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         🎬追剧系列--全网VIP视频破解(精简版)
// @namespace    http://tampermonkey.net/
// @version      1.2.1
// @description  全网VIP视频解析 - 目前支持腾讯、爱奇艺、优酷、芒果TV、B站
// @match        https://www.iqiyi.com/*
// @match        https://v.qq.com/x/cover/*
// @match        https://www.mgtv.com/b/*
// @match        https://v.youku.com/v_show/*
// @match        https://youku.com/v_show/*
// @match        https://www.bilibili.com/*
// @license      MIT
// @grant        none
// ==/UserScript==

(function () {
  "use strict";

  // 引入 SweetAlert2 并确保样式加载正确
  const loadSweetAlert = () => {
    const swalCss = document.createElement("link");
    swalCss.rel = "stylesheet";
    swalCss.href = "";
    document.head.appendChild(swalCss);

    const swalScript = document.createElement("script");
    swalScript.src = "https://cdn.jsdelivr.net/npm/sweetalert2@11";
    document.head.appendChild(swalScript);

    return new Promise((resolve) => {
      swalScript.onload = resolve;
    });
  };

  // 添加自定义样式,防止与其他组件冲突
  const addGlobalStyle = () => {
    const style = document.createElement("style");
    style.textContent = `
      /* 通用样式 */
      ::-webkit-scrollbar {
          width: 10px !important;
      }
      ::-webkit-scrollbar-thumb {
          background: #8e8e8e !important;
          border-radius: 10px !important;
      }
      ::-webkit-scrollbar-thumb:hover {
          background: #555555 !important;
      }
      .no-select {
          user-select: none;
      }
      .button-container {
          position: fixed;
          top: 50%;
          left: 60px;
          transform: translate(0, -50%);
          z-index: 99999999;
          display: none;
          grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
          grid-gap: 10px;
      }
      .vip-button {
          background: #b8860b;
          border: 0;
          padding: 0 25px;
          height: 30px;
          color: #000;
          cursor: pointer;
          display: flex;
          align-items: center;
          justify-content: center;
          font-size: 14px;
          font-weight: bold;
          margin: 5px 0;
          transition: transform 0.3s, background-color 0.3s;
      }
      .vip-button:hover {
          background: #daa520;
          transform: scale(1.1);
      }
      /* 确保 SweetAlert2 弹窗样式不受其他全局样式影响 */
      .swal2-container {
          z-index: 100000000 !important;
      }
    `;
    document.head.appendChild(style);
  };

  // 创建解析按钮
  const createParseButton = () => {
    const parseButton = document.createElement("div");
    parseButton.className = "no-select";
    parseButton.style.cssText = `
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background-color: #b8860b;
      position: fixed;
      left: 0;
      top: 50%;
      cursor: pointer;
      z-index: 99999999;
      transform: translate(0, -50%);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: black;
      font-size: 13px;
      font-weight: bold;
      box-shadow: rgb(0 0 0 / 30%) 0px 2px 5px;
    `;
    parseButton.textContent = "VIP";
    parseButton.title = "公众号:软件小邓";
    return parseButton;
  };

  // 创建解析接口按钮容器
  const createButtonContainer = (apiList) => {
    const container = document.createElement("div");
    container.className = "button-container";

    apiList.forEach(api => {
      const button = document.createElement("button");
      button.className = "vip-button";
      button.textContent = api.name;
      button.addEventListener("click", (event) => {
        event.stopPropagation(); // 防止点击按钮时关闭接口容器
        window.open(`${api.url}${window.location.href}`, "_blank");
      });
      container.appendChild(button);
    });

    return container;
  };

  // 显示用户协议弹窗,并添加二维码
  const showTermsPopup = async () => {
    const result = await Swal.fire({
      title: "用户协议",
      html: `
        <div style='text-align:left; font-size:14px;'>
          免责声明:<br>
          1. VIP视频解析中所用到的解析接口来自于网络,版权问题请联系相关解析接口所有者。<br>
          2. 为创造良好的创作氛围,请大家支持正版。<br>
          3. 脚本仅用于学习,切勿用于任何商业用途。<br>
          4. 个别解析线路带有可选的额外收费提速功能,这是线路行为,与脚本作者无关。<br>
          5. 如发现有线路含有广告,请千万不要相信,并请及时反馈,我会第一时间移除该线路。<br>
          6. 点击同意,即表明你已经明确使用脚本可能带来的风险,且愿意自行承担相关风险,对于风险网站不承担任何责任。
          <br><br>
         <div style="text-align:center;">
            <span>Zlibrary最新地址,各种实用软件等</span><br>
            <span>请关注公众号:软件小邓</span><br>
            <img src="https://cdn.nlark.com/yuque/0/2024/jpeg/34535917/1723918243759-5f0a7e2d-c391-4865-91f6-c727a69eadc7.jpeg?x-oss-process=image%2Fformat%2Cwebp" alt="二维码" style="width:150px;height:150px;display:block;margin:10px auto;">
          </div>
        </div>`,
      icon: "warning",
      showCancelButton: true,
      confirmButtonText: "我已仔细阅读并同意",
      cancelButtonText: "取消",
      reverseButtons: true,
    });

    if (result.isConfirmed) {
      await Swal.fire({
        title: "已确认",
        text: "您已经同意用户协议。",
        icon: "success",
        timer: 2000,
        showConfirmButton: false
      });
      return true;
    } else {
      await Swal.fire({
        title: "已取消",
        text: "您取消了用户协议。",
        icon: "error",
        timer: 2000,
        showConfirmButton: false
      });
      return false;
    }
  };

  // 主逻辑
  const main = async () => {
    await loadSweetAlert(); // 加载 SweetAlert2

    addGlobalStyle();

    const parseButton = createParseButton();
    const apiList = [
      { name: "综合/B站", url: "https://jx.bozrc.com:4433/player/?url=" },
      { name: "夜幕", url: "https://www.yemu.xyz/?url=" },
      { name: "爱豆", url: "https://jx.aidouer.net/?url=" },
      { name: "虾米", url: "https://jx.xmflv.com/?url=" },
      { name: "纯净1", url: "https://im1907.top/?jx=" },
      { name: "冰豆", url: "https://api.qianqi.net/vip/?url=" },
    ];

    const buttonContainer = createButtonContainer(apiList);
    document.body.appendChild(parseButton);
    document.body.appendChild(buttonContainer);

    let isVisible = false;
    parseButton.addEventListener("click", async (event) => {
      if (!localStorage.getItem("agreedToTerms")) {
        const agreed = await showTermsPopup();
        if (!agreed) {
          // 用户取消,脚本不执行
          return;
        }
        localStorage.setItem("agreedToTerms", "true");
      }

      isVisible = !isVisible;
      buttonContainer.style.display = isVisible ? "block" : "none";
      parseButton.textContent = isVisible ? "隐藏" : "VIP";
      event.stopPropagation(); // 防止点击解析按钮时关闭接口容器
    });

    // 点击页面任意地方隐藏接口
    document.addEventListener("click", () => {
      if (isVisible) {
        buttonContainer.style.display = "none";
        parseButton.textContent = "VIP";
        isVisible = false;
      }
    });

    // 防止点击接口按钮时关闭接口容器
    buttonContainer.addEventListener("click", (event) => {
      event.stopPropagation();
    });
  };

  main();
})();