Created
April 27, 2024 12:38
-
-
Save djsegal/fd9eea3c317dffd86aa964f2d3f235c3 to your computer and use it in GitHub Desktop.
A bookmarklet for loading German subtitles on Netflix using Language Reactor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() { function setTracks() { let video = document.querySelector('video'); if (!video || !window.lln || !window.lln.vidMan) return; let isGoodTrack = ( window.lln.setMan.sourceLanguageCode === "de" && window.lln.setMan.translationLanguageCode === "en" ); if (!isGoodTrack) { window.lln.vidMan.setAudioTrack("A:2:1;2;de;0;0;"); window.lln.vidMan.setSubtitleTrack("ASR_A:2:1;2;de;0;0;"); video.pause(); return; } let subsContent = document.querySelector("#lln-subs-content"); if (subsContent && subsContent.textContent.trim() === "- Loading subtitles, please wait... -") { if (!video.paused) video.pause(); setTimeout(setTracks, 1000); return; } if (video.paused) video.play(); } function waitForLLN(tries = 0) { if (document.querySelector('video') && window.lln && window.lln.vidMan) { setTracks(); return; } if (tries > 30) { console.error("Custom language connector failed."); return; } setTimeout(function() { waitForLLN(tries + 1); }, 500); } waitForLLN();})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment