transcript-youtube-video is a Python bot that automatically collects YouTube video transcripts and saves the content into a .txt file.
It uses the automated browser Playwright to open the video, access the transcript, and export it — all with just one command.
Before starting, make sure the following tools are installed on your system:
git -vIf the output looks like "git version 2.x.x", you're good to go.
git clone https://github.com/flameastro/transcript-youtube-video.gitpip install playwright
playwright installInside the project folder, run:
python main.pyThe program will ask for a YouTube video link:
⚠️ Note: In the example below, I'm using a link from Gustavo Guanabara's course just for testing.
Enter the YouTube video URL:
>>> https://www.youtube.com/watch?v=FdePtO5JSd0
It will also ask if you want to include timestamps in the transcript.txt file.
(Timestamps indicate where in the video each piece of text appears. You can better understand this by comparing a
file with timestamps and another
file without timestamps)
Do you want to collect timestamps as well? [y/n]:
>>> y
After that, a Chromium browser window will open automatically. Just wait a few seconds while the bot collects the transcript.
If everything goes well ✅, the transcript will be saved in the transcript.txt file.
transcript-youtube-video/
├─ assets/
│ ├─ code.png
│ ├─ transcript-v1.png
│ └─ transcript-v2.png
├─ examples/
│ ├─ transcript-v1.txt
│ └─ transcript-v2.txt
├─ LICENSE
├─ main.py
├─ README.md
└─ transcript.txt # automatically generated after execution
Example with timestamps
![]()
Example without timestamps
![]()
-
Some videos do not have a transcript, especially when:
- They are music videos
- They have little or no audio
- The creator disabled automatic captions
In these cases, the transcript.txt file may be empty.
transcript-youtube-video é um bot em Python que coleta automaticamente a transcrição de vídeos do YouTube e salva o conteúdo em um arquivo .txt.
Ele utiliza o navegador automatizado Playwright para abrir o vídeo, localizar a transcrição e exportá-la — tudo isso com apenas um comando.
Antes de começar, certifique-se de ter os seguintes itens instalados no seu sistema:
git -vSe a saída for algo como "git version 2.x.x", você está pronto para continuar.
git clone https://github.com/flameastro/transcript-youtube-video.gitpip install playwright
playwright installDentro da pasta do projeto, rode:
python main.pyO programa pedirá um link do vídeo do YouTube:
⚠️ Aviso: Neste exemplo, estou usando o link do curso do Gustavo Guanabara. Apenas para fins de testes.
Insira a URL do vídeo do YouTube:
>>> https://www.youtube.com/watch?v=FdePtO5JSd0
E também perguntará se você deseja adicionar tempo ou não no arquivo transcript.txt. O tempo sinaliza qual é a parte do vídeo que aquele determinado texto está. (Você pode entender isso melhor comparando um arquivo que possui tempo e outro arquivo que não possui tempo)
Deseja coletar o tempo também? [s/n]:
>>> s
Após inserir, uma nova janela do navegador Chromium será aberta automaticamente. Basta aguardar alguns segundos enquanto o bot coleta a transcrição.
Se tudo correr bem ✅, a transcrição será salva no arquivo transcript.txt.
transcript-youtube-video/
├─ assets/
│ ├─ code.png
│ ├─ transcript-v1.png
│ └─ transcript-v2.png
├─ examples/
│ ├─ transcript-v1.txt
│ └─ transcript-v2.txt
├─ LICENSE
├─ main.py
├─ README.md
└─ transcript.txt # gerado automaticamente após a execução
Um exemplo de saída com tempo
Um exemplo de saída sem tempo
-
Alguns vídeos não possuem transcrição, principalmente quando:
- São músicas ou clipes
- Possuem pouco ou nenhum áudio
- O autor desativou as legendas automáticas
Nesses casos, o arquivo transcript.txt pode ficar vazio.


