Greasy Fork

Greasy Fork is available in English.

音视频解析

支持爱奇艺,Bilibili,优酷,腾讯视频,AcFun,网易云音乐

目前为 2024-12-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         音视频解析
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  支持爱奇艺,Bilibili,优酷,腾讯视频,AcFun,网易云音乐
// @author       我
// @match        *://*.163.com/*/song?id=*
// @match        *://*.iqiyi.com/v*
// @match        *://*.bilibili.com/bangumi/play/*
// @match        *://*.youku.com/alipay_video/id_*
// @match        *://*.v.qq.com/x/*/play?cid=*
// @match        *://*.acfun.cn/v/?ab=*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 处理网易云音乐的重定向
    const currentUrl = window.location.href;
    const regex = /id=(\d+)/;
    const match = currentUrl.match(regex);

    if (match && match[1]) {
        const songId = match[1];
        const newUrl = `http://music.163.com/song/media/outer/url?id=${songId}`;

        // 弹出确认窗口
        let confirmRedirect = confirm(`确定播放?`);
        if (confirmRedirect) {
            window.location.href = newUrl;
            return; // 结束函数,避免后续代码执行
        }
    }

    // 处理视频解析,只有在没有重定向的情况下才执行
    if (!match) {
        let ok = confirm('确定播放?');
        if (ok) {
            let url = window.location.href;
            if (url.includes("bilibili.com")) {
                window.location.href = "https://jx.xymp4.cc/?url=" + url;
            } else if (url.includes("youku.com") || url.includes("v.qq.com") || url.includes("iqiyi.com")) {
                window.location.href = "https://jx.xmflv.com/?url=" + url;
            } else if (url.includes("acfun.cn")) {
                window.location.href = "https://jx.playerjy.com/?url=" + url;
            }
        }
    }
})();