emirgoren / breaker

Breaker for users to read long subtitles while watching Netflix.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

breaker

Breaker for users to read long subtitles while watching Netflix.

Usage

1 => Open the video from Netflix. Like `https://www.netflix.com/watch/70189007`.
2 => Enter the script to Chrome's console.
let netflixStoppedOn = '';

let mainInterval = setInterval(() => {
    breaker(mainInterval);
}, 1000);

function breaker(interval){
    let subtitleFirstParent = document.getElementsByClassName("player-timedtext")[0];
    let subtitleSpans = subtitleFirstParent.children[0]?.children;
    if(subtitleSpans !== undefined) {
        let subtitle = '';
        for(let i = 0; i < subtitleSpans.length; i++) {
            subtitle += subtitleSpans[i].innerText;
        }
        
        if(subtitle.length >= 45 && subtitle !== netflixStoppedOn){
            const video = document.getElementsByTagName("video")[0];
            video.pause();
            netflixStoppedOn = subtitle;

            clearInterval(interval);
            setTimeout(() => {
                video.play();
                mainInterval = setInterval(() => {
                    breaker(mainInterval);
                }, 1000);
            }, 1700);
        }
    }
}

About

Breaker for users to read long subtitles while watching Netflix.

License:MIT License


Languages

Language:JavaScript 100.0%