有谱么网站 修改非会员的吉他谱播放时长

查看 115|回复 11
作者:kangaroo711   
[color=]** 以下操作快捷键均为Mac, Win请自行对应快捷键 **

1. 登陆有谱么网站,选择吉他谱进入看谱页面, 点击播放按钮


image.png (295.47 KB, 下载次数: 0)
下载附件
2025-8-28 10:37 上传

2.发现每次都是15s后弹出开通会员弹窗,network没看到api请求,锁定是用了setTimeout定时器


image.png (280.86 KB, 下载次数: 0)
下载附件
2025-8-28 10:37 上传

3. F12打开控制台,点击Network仪表台, 刷新页面,Network内容列表显示所有加载的文件


image.png (240.76 KB, 下载次数: 0)
下载附件
2025-8-28 10:40 上传

4. Command+F 搜索关键字“会员特权”, 找到了对于的js文件,右键选择Open in the Sources panel


image.png (451.47 KB, 下载次数: 0)
下载附件
2025-8-28 10:34 上传

5. Sources中选择overrides,操作看图


image.png (448.79 KB, 下载次数: 0)
下载附件
2025-8-28 10:45 上传

6. 定位代码


image.png (543.23 KB, 下载次数: 0)
下载附件
2025-8-28 10:47 上传

7.修改代码
Bc.SECOND * (i === fn.PIANO ? 60 : 15) 改为 Bc.SECOND * 9999999999


image.png (249.91 KB, 下载次数: 0)
下载附件
2025-8-28 10:49 上传

8.刷新页面重新播放, 成功解除15s限制


image.png (122.43 KB, 下载次数: 0)
下载附件
2025-8-28 10:51 上传

下载次数, 下载附件

symbx   

// ==UserScript==
// @name         去除 yopu.co 15秒会员限制
// @version      1.0
// @description  覆盖 setTimeout,解除 15 秒会员弹窗限制
// @match        *://yopu.co/*
// @run-at       document-start
// ==/UserScript==
(function() {
    'use strict';
    // 提前在页面作用域执行
    const hook = () => {
        const raw = unsafeWindow.setTimeout; // 访问页面真正的 setTimeout
        unsafeWindow.setTimeout = function(fn, time) {
            if (time === 15000) {
                return raw(fn, 9999999999);
            }
            return raw(fn, time);
        };
    };
    // 直接执行
    hook();
})();
感谢楼主分享,弄了个油猴脚本
symbx   

// ==UserScript==
// @name         打印 youpu 助手
// @version      1.0
// @description  自动加载完整内容并插入“打印/另存”按键
// @match        https://yopu.co/view/*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    const pageTitle = document.title || "打印内容";
    // 智能滚动加载内容直到全部显示
    async function scrollToEnd(container) {
        return new Promise(resolve => {
            let lastScrollHeight = 0;
            const scrollStep = () => {
                container.scrollBy(0, 200); // 每次滚动 200px
                const currentScrollHeight = container.scrollHeight;
                // 如果 scrollHeight 没有增加,说明内容加载完毕
                if (currentScrollHeight === lastScrollHeight || container.scrollTop + container.clientHeight >= currentScrollHeight) {
                    resolve();
                } else {
                    lastScrollHeight = currentScrollHeight;
                    requestAnimationFrame(scrollStep);
                }
            };
            scrollStep();
        });
    }
    function createPrintButton(controlSection, content) {
        if (!controlSection || !content) return;
        if (document.querySelector("#tm-print-btn")) return;
        const newBtnContainer = document.createElement("div");
        newBtnContainer.className = "button-container svelte-8xk2fn";
        const btn = document.createElement("button");
        btn.id = "tm-print-btn";
        btn.setAttribute("size", "big");
        btn.setAttribute("theme", "white");
        btn.setAttribute("type", "button");
        btn.className = "svelte-14csrjh block";
        btn.innerHTML = `♬ 打印/另存`;
        newBtnContainer.appendChild(btn);
        controlSection.appendChild(newBtnContainer);
        btn.addEventListener("click", async () => {
            // 展开滚动容器,确保完整内容加载
            content.style.height = "auto";
            content.style.overflow = "visible";
            // 滚动加载所有懒加载内容
            await scrollToEnd(content);
            // 克隆内容
            const cloneContent = content.cloneNode(true);
            // 复制所有 Web 字体
            const fontRules = Array.from(document.styleSheets).map(sheet => {
                try {
                    return Array.from(sheet.cssRules)
                        .filter(rule => rule instanceof CSSFontFaceRule)
                        .map(rule => rule.cssText)
                        .join('\n');
                } catch (e) {
                    return '';
                }
            }).join('\n');
            // 复制所有样式
            const styleRules = Array.from(document.styleSheets).map(sheet => {
                try {
                    return Array.from(sheet.cssRules)
                        .map(rule => rule.cssText)
                        .join('\n');
                } catch (e) {
                    return '';
                }
            }).join('\n');
            // 创建隐藏 iframe 打印
            const iframe = document.createElement("iframe");
            iframe.style.position = "fixed";
            iframe.style.width = "0";
            iframe.style.height = "0";
            iframe.style.border = "0";
            document.body.appendChild(iframe);
            const doc = iframe.contentDocument || iframe.contentWindow.document;
            doc.open();
            doc.write(`
               
               
                    ${pageTitle}
                    
                    
                        ${fontRules}
                        ${styleRules}
                        body { margin: 0; }
                        svg { max-width: 100%; height: auto; }
                    
               
                ${cloneContent.outerHTML}
               
            `);
            doc.close();
            iframe.contentWindow.focus();
            iframe.contentWindow.print();
            // 打印完成后移除 iframe,恢复原内容样式
            setTimeout(() => {
                document.body.removeChild(iframe);
                content.style.height = "";
                content.style.overflow = "";
            }, 1000);
        });
    }
    // 使用 MutationObserver 动态监控页面
    const observer = new MutationObserver(() => {
        const controlSection = document.querySelector("section.control");
        const content = document.querySelector(".at-surface");
        if (controlSection && content) {
            createPrintButton(controlSection, content);
        }
    });
    observer.observe(document.body, { childList: true, subtree: true });
})();
参考大佬们的思路,尝试弄了个打印脚本。
zywe   

好教程,几乎手把手
YouXiuDaMing666   

想做到这一步需要学会什么才够啊
kangaroo711
OP
  


YouXiuDaMing666 发表于 2025-8-28 16:59
想做到这一步需要学会什么才够啊

学习前端知识即可
kangaroo711
OP
  


zywe 发表于 2025-8-28 16:40
好教程,几乎手把手

第一次发教程贴, 感谢认可
dzdzdzd   

直接把setTimeout 置空好像也行
kangaroo711
OP
  


dzdzdzd 发表于 2025-8-28 17:09
直接把setTimeout 置空好像也行

很好的思路! 缺点就是每次播放都要在控制台clear一次,切换标签也是
dzdzdzd   


kangaroo711 发表于 2025-8-28 17:12
很好的思路! 缺点就是每次播放都要在控制台clear一次,切换标签也是

油猴 + document end时机执行,不过还是你的分析思路值得学习
您需要登录后才可以回帖 登录 | 立即注册

返回顶部