Greasy Fork is available in English.

YouTube视频&音乐&儿童广告拦截

拦截所有youtube视频广告,音乐播放广告,儿童视频广告,不留白,不闪屏,无感,体验第一。已适配移动端,支持自定义拦截,添加影视频道

< Părere la script-ul YouTube视频&音乐&儿童广告拦截

Recenzie: OK - script works, but has bugs

發現以下代碼影響聊天室運作

(最初的留言要等很長時間。)

建議白名單

聊天室的iframe應該不用這腳本吧? 暫時未有聊天室內的廣告

// @exclude      /^https?://\w+\.youtube\.com\/live_chat.*$/
// @exclude      /^https?://\S+\.(txt|png|jpg|jpeg|gif|xml|svg|manifest|log|ini)[^\/]*$/

問題代碼


   get xhrResponseValue() {
            const xhr = this;
            let result = super.response;
            if (xhr.readyState === XMLHttpRequest.DONE) {
                if (xhr.responseURL.includes('youtubei/v1/player')) {
                    // music_watch
                    result = data_process.text_process(result, ytInitialPlayerResponse_rule, 'insert', true);
                }
                if (xhr.responseURL.includes('youtube.com/playlist')) {
                    let obj;
                    try {
                        obj = JSON.parse(result);
                    } catch (error) {
                        log('JSON解析失败', 1);
                        return result;
                    }
                    data_process.obj_process(obj[2].playerResponse, ytInitialPlayerResponse_rule, true);
                    data_process.obj_process(obj[3].response, ytInitialData_rule, true);
                    tmp_debugger_value = obj;
                    result = JSON.stringify(obj);
                }
            } else {
                result = '';
            }
            return result;
        }

這個

            } else {
                result = '';
            }

是多餘的吧

為什麼要改動XHR本來的東西?

而且如果這個XHR是STREAM的話,這個result可能是有用

建議除掉

response 和 responseText

response 和 responseText 應該是兩個東西吧

應該分開


我把臨時的修正版放在這裡,請參考

https://github.com/cyfung1031/userscript-supports/raw/main/tmp-480192.user.js

§
Postat în: 04-05-2024

response和responseText應該是兩個東西吧这两个确实该改一下 ,聊天室加载慢估计你可能开了shorts推荐的仅订阅,造成那时候网络卡顿,接下来更新版本要修复了。按照脚本逻辑来说即使注入到聊天页面也不会对网络内容进行修改的。@exclude 确实可以用下,以前都没用。感谢指正,nice

Postează un raspuns

Autentifică-te pentru a posta un răspuns.