Created
July 23, 2026 14:51
-
-
Save MoisesTedeschi/458334f9a6feea3882842d980c770edd to your computer and use it in GitHub Desktop.
Ler artigo do LinkedIn
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
| function lerArtigoLinkedIn() { | |
| // 1. Localiza a tag principal onde fica o corpo do artigo no LinkedIn | |
| const artigoContainer = document.querySelector('.article-main-content') | |
| || document.querySelector('.reader-article-content') | |
| || document.querySelector('article'); | |
| if (!artigoContainer) { | |
| console.error('Não foi possível encontrar o texto do artigo.'); | |
| return; | |
| } | |
| // 2. Extrai todo o texto da estrutura | |
| const texto = artigoContainer.innerText; | |
| // 3. Cancela leituras anteriores que estejam em andamento | |
| window.speechSynthesis.cancel(); | |
| // 4. Instancia o objeto de fala | |
| const utterance = new SpeechSynthesisUtterance(texto); | |
| // 5. Configurações de idioma e velocidade | |
| utterance.lang = 'pt-BR'; // Define o idioma | |
| utterance.rate = 1.5; // Velocidade da leitura (ex: 1.2 para mais rápido) | |
| utterance.pitch = 1.0; // Tom da voz | |
| // 6. Tenta selecionar uma voz em português disponível no navegador | |
| const voices = window.speechSynthesis.getVoices(); | |
| const vozPT = voices.find(v => v.lang.includes('pt-BR') || v.lang.includes('pt')); | |
| if (vozPT) { | |
| utterance.voice = vozPT; | |
| } | |
| // Eventos para feedback | |
| utterance.onstart = () => console.log('Iniciando a leitura do artigo...'); | |
| utterance.onend = () => console.log('Leitura concluída!'); | |
| // 7. Inicia a leitura | |
| window.speechSynthesis.speak(utterance); | |
| } | |
| // Para executar: | |
| lerArtigoLinkedIn(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment