TheRealJoelmatic / RemoveAdblockThing

The intrusive "Ad blocker are not allowed on YouTube" message is annoying. This open-source project aims to address this issue by providing a solution to bypass YouTube's ad blocker detection
http://joelmatic.com/
MIT License
6.06k stars 331 forks source link

Youtube shorts black screen after latest update. #502

Closed Ameer-Jamal closed 3 months ago

Ameer-Jamal commented 4 months ago

Script version 5.5

Describe the bug Opening a youtube short results in the audio being played but the screen being black, so the video is running but its like just black you cant see it, when I disable the script the video shows. Please fix, thanks devs!

Expected behavior youtube shorts working and video showing as without this script

Screenshots image

Desktop (please complete the following information):

Ameer-Jamal commented 4 months ago
        //
        // Get the url
        //

        let videoID = '';
        const baseVideoURL = 'https://www.youtube.com/watch?v=';
        const baseShortsURL = 'https://www.youtube.com/shorts/';

        let startIndex = currentUrl.indexOf(baseVideoURL);

        if (startIndex !== -1) {
            // Extract the part of the URL after the base URL
            const videoIDStart = startIndex + baseVideoURL.length;
            videoID = currentUrl.substring(videoIDStart);

            const ampersandIndex = videoID.indexOf('&');
            if (ampersandIndex !== -1) {
                videoID = videoID.substring(0, ampersandIndex);
            }
        } else {
            startIndex = currentUrl.indexOf(baseShortsURL);
            if (startIndex !== -1) {
                // Extract the part of the URL after the base URL
                const videoIDStart = startIndex + baseShortsURL.length;
                videoID = currentUrl.substring(videoIDStart);

                const slashIndex = videoID.indexOf('/');
                if (slashIndex !== -1) {
                    videoID = videoID.substring(0, slashIndex);
                }
            } else {
                log("YouTube video URL not found.", "e")
                return null;
            }
        }

Im working on it , its because the url isnt properly parsed for shorts, but for some reason im getting double audio

Ameer-Jamal commented 4 months ago

PR #505 505 Up to help solve this