成人交流 · text · 0 分 · 评论 0 · 阅读 1

做了个【视频在线浏览】的脚本。

疑似遇到封面杀怎么办?
遇到老师的新片子,一秒钟没看到,二弟就饥渴难耐了怎么办?
那就直接在线观看吧!



// ==UserScript==
// @name         Javbus → 123av 智能跳转
// @namespace    http://tampermonkey.net/
// @Version      1.1
// @description  自动识别 Javbus 风格页面,添加跳转到 123av 的按钮(支持任意域名)
// @author       You
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // 防止重复执行
    if (window.__javbus123avInjected) return;
    window.__javbus123avInjected = true;

    // 判断是否为 Javbus 风格页面的核心逻辑
    function isJavbusPage() {
        // 1. 页面是否有明显的番号标题(常见格式:字母-数字)
        const title = document.title || '';
        const hasCodeInTitle = /[A-Z]{2,10}-\d{2,5}/i.test(title);

        // 2. 页面是否存在常见的 Javbus 结构元素
        const hasMovieInfo = document.querySelector('.movie, #movie-share, .container .row, .info, .sample-box, .magnet-box, #magnet-table');
        const hasCover = document.querySelector('img.bigImage, .bigImage, .poster, a.bigImage');
        const hasMagnet = document.querySelector('a[href*="magnet:"], #magnet-table, .magnet-name');

        // 3. URL 路径是否像番号页
        const pathMatch = location.pathname.match(/^\/([A-Za-z0-9]+-\d+)/i);

        // 满足以下任意两个条件就认为是 Javbus 页面
        let score = 0;
        if (hasCodeInTitle) score++;
        if (hasMovieInfo) score++;
        if (hasCover) score++;
        if (hasMagnet) score++;
        if (pathMatch) score++;

        return score >= 2;
    }

    // 提取番号
    function getCode() {
        // 优先从 URL 提取
        const pathMatch = location.pathname.match(/^\/([A-Za-z0-9]+-\d+)/i);
        if (pathMatch) return pathMatch[1].toLowerCase();

        // 从标题提取
        const titleMatch = document.title.match(/([A-Z]{2,10}-\d{2,5})/i);
        if (titleMatch) return titleMatch[1].toLowerCase();

        // 从页面常见元素提取
        const h3 = document.querySelector('h3');
        if (h3) {
            const h3Match = h3.textContent.match(/([A-Z]{2,10}-\d{2,5})/i);
            if (h3Match) return h3Match[1].toLowerCase();
        }

        return null;
    }

    // 创建按钮
    function createButton(code) {
        const targetUrl = `https://123av.com/en/v/${code}`;

        const btn = document.createElement('a');
        btn.href = targetUrl;
        btn.target = '_blank';
        btn.rel = 'noopener noreferrer';
        btn.textContent = '去 123av 观看';
        btn.id = 'javbus-to-123av-btn';

        btn.style.cssText = `
            position: fixed;
            top: 100px;
            right: 20px;
            z-index: 99999;
            background: #e74c3c;
            color: #fff;
            padding: 11px 18px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: bold;
            text-decoration: none;
            box-shadow: 0 4px 12px rgba(0,0,0,0.25);
            transition: all 0.2s;
            font-family: system-ui, sans-serif;
        `;

        btn.onmouseenter = () => {
            btn.style.background = '#c0392b';
            btn.style.transform = 'translateY(-2px)';
        };
        btn.onmouseleave = () => {
            btn.style.background = '#e74c3c';
            btn.style.transform = 'translateY(0)';
        };

        document.body.appendChild(btn);
    }

    // 主逻辑
    function init() {
        if (!isJavbusPage()) return;

        const code = getCode();
        if (!code) return;

        // 避免重复添加按钮
        if (document.getElementById('javbus-to-123av-btn')) return;

        createButton(code);
    }

    // 页面加载完成后执行
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', init);
    } else {
        init();
    }

    // 针对部分镜像站可能用 AJAX 加载内容,再延迟检测一次
    setTimeout(init, 1500);
})();




效果预览:







教程:
(建议开启魔法。虽然这个脚本支持国内直连的防屏蔽网址,但跳转的在线观看网址估计是需要魔法的。)
1、去常用的浏览器下载:篡改猴/油猴(打开开发者模式,还是管理员模式还是啥,我忘了,反正要给它权限),开启。
2、给它在浏览器上放个插件的位置,每个浏览器不一样,不会了问豆包
3、点开篡改猴图标点击【添加新脚本】

4、在弹出的页面复制上面的代码ctrl+s保存

5、去第3步,在上面的那些代码前面点击绿灯开启。
6、刷新网站,就可以运行了!

评论 (0)

登录 后参与讨论。

还没有评论,来抢沙发吧。