Greasy Fork

Greasy Fork is available in English.

VIP视频解析库

提供VIP视频解析服务的核心库

当前为 2025-09-29 提交的版本,查看 最新版本

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/551022/1668595/VIP%E8%A7%86%E9%A2%91%E8%A7%A3%E6%9E%90%E5%BA%93.js

// ==UserScript==
// @name         VIP视频解析库
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  提供VIP视频解析服务的核心库
// @author       YourName
// @grant        GM_xmlhttpRequest
// @grant        GM_setValue
// @grant        GM_getValue
// ==/UserScript==

class VipParser {
  constructor() {
    this.parserList = [
      {"name": "789解析", "url": "https://jiexi.789jiexi.icu:4433/?url="},
      {"name": "极速解析", "url": "https://jx.2s0.cn/player/?url="},
      {"name": "冰豆解析", "url": "https://bd.jx.cn/?url="},
      {"name": "973解析", "url": "https://jx.973973.xyz/?url="},
      {"name": "虾米视频解析", "url": "https://jx.xmflv.com/?url="},
      {"name": "CK", "url": "https://www.ckplayer.vip/jiexi/?url="},
      {"name": "七哥解析", "url": "https://jx.nnxv.cn/tv.php?url="},
      {"name": "夜幕", "url": "https://www.yemu.xyz/?url="},
      {"name": "盘古", "url": "https://www.pangujiexi.com/jiexi/?url="},
      {"name": "playm3u8", "url": "https://www.playm3u8.cn/jiexi.php?url="},
      {"name": "七七云解析", "url": "https://jx.77flv.cc/?url="},
      {"name": "芒果TV1", "url": "https://video.isyour.love/player/getplayer?url="},
      {"name": "芒果TV2", "url": "https://im1907.top/?jx="},
      {"name": "HLS解析", "url": "https://jx.hls.one/?url="}
    ];
    this.successCounts = GM_getValue('parser_success_counts', {});
    this.currentIndex = GM_getValue('parser_current_index', 0);
  }

  // 获取最佳解析源
  getBestParser() {
    let bestIndex = 0;
    let bestSuccessRate = -1;
    
    for (let i = 0; i < this.parserList.length; i++) {
      const successCount = this.successCounts[i] || 0;
      const successRate = successCount;
      
      if (successRate > bestSuccessRate) {
        bestSuccessRate = successRate;
        bestIndex = i;
      }
    }
    
    return this.parserList[bestIndex];
  }

  // 获取下一个解析源
  getNextParser(currentIndex) {
    for (let i = 0; i < this.parserList.length; i++) {
      const idx = (currentIndex + i + 1) % this.parserList.length;
      return {
        parser: this.parserList[idx],
        index: idx
      };
    }
    return null;
  }

  // 记录解析成功
  recordSuccess(index) {
    this.successCounts[index] = (this.successCounts[index] || 0) + 1;
    GM_setValue('parser_success_counts', this.successCounts);
    this.currentIndex = index;
    GM_setValue('parser_current_index', index);
  }

  // 记录解析失败
  recordFailure(index) {
    this.successCounts[index] = this.successCounts[index] || 0;
    GM_setValue('parser_success_counts', this.successCounts);
  }

  // 获取解析URL
  getParseUrl(videoUrl, parserIndex) {
    const parser = this.parserList[parserIndex];
    return parser ? parser.url + encodeURIComponent(videoUrl) : null;
  }
}

// 创建全局解析器实例
window.vipParser = new VipParser();