Created
October 25, 2024 14:14
-
-
Save David256/c3261c8b2e4087a00efcb73c6dabdad0 to your computer and use it in GitHub Desktop.
Javascript to automatically translate tweets
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
window.translator = setInterval(() => { | |
document.querySelectorAll('[data-testid="tweetText"][lang="en"]').forEach(tweetText => { | |
const parent = tweetText.parentNode; | |
const translateButton = parent.querySelector('button span'); | |
if (translateButton && translateButton.textContent.includes("Traducir post")) { | |
translateButton.closest('button').click(); | |
console.log(translateButton) | |
tweetText.style.color = "#555"; | |
} | |
}); | |
}, 4000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment