fixYoutubeEmbeds - Support locales other than english (#2128)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Kuba (kb) 2024-02-06 17:18:49 +01:00 committed by GitHub
parent 115da04724
commit 8b3189f1ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,8 +16,9 @@ app.on("browser-window-created", (_, win) => {
frame.executeJavaScript(` frame.executeJavaScript(`
new MutationObserver(() => { new MutationObserver(() => {
let err = document.querySelector(".ytp-error-content-wrap-subreason span")?.textContent; if(
if (err && err.includes("blocked it from display")) window.location.reload() document.querySelector('div.ytp-error-content-wrap-subreason a[href^="https://www.youtube.com/watch?v="]')
) location.reload()
}).observe(document.body, { childList: true, subtree:true }); }).observe(document.body, { childList: true, subtree:true });
`); `);
} }