DEV Community

Cover image for youtube-transcript: A tool to fetch YouTube video transcripts via Web UI and CLI
Nilesh Kumar
Nilesh Kumar

Posted on

youtube-transcript: A tool to fetch YouTube video transcripts via Web UI and CLI

SITUATION

I watch a lot of YouTube videos and more often than not, I also do multi-tasking meaning while I am working on something, I like to open YouTube every now and then and want to watch a Video.

But a lot of the times, I realize that:

  • Either the video duration is quite large that I cannot spend time watching it
  • Or, that I cannot watch a video because I do not have headsets and will have to unmute and listed to the audio which means I will need a private space

In such scenarios, I preferred that there was a transcript available to just read through it. Yes, YouTube has transcripts but if you tell me that it is very seamless where you 1st open the video and then somewhere hidden is a Transcript CTA and you click on it to read it, I will say, you are wrong. It is the worst experience to have.

Yes, there is 1 more way, where you keep the video muted and then select Auto Generated captions to appear on video. It works until you don't have enough time to be on the video and read those captions.

SOLUTION

Hence, I built youtube-transcript which has both a Website and a CLI.

  • You can look at the website here: https://youtube-transcript-zb5k.onrender.com/

    • It is free and easy to use
    • The UI is not fancy and is designed to make the core functionality work which is:
      • You input Video URL and click on Fetch Transcript
      • It then gives you the full transcript that resides hidden in YouTube videos
      • There are options to copy and download if you need it to pass in any LLM as well
  • Then the 2nd offering is CLI

    • It is simple enough to install

      • You can either do pip install youtube-transcript-tools
      • Or if you are a Mac user, then you can do; - brew tap nilukush/ytt brew install youtube-transcript-tools
      • Post this, you run the cli from your terminal like:
        • ytt fetch "https://youtu.be/BTbvJQXiCDc?si=lCQkKOvs7qmmO-jt"
        • This gives you the transcript in your terminal
        • In addition to this, there are myriad other options if you want the transcript in different languages if transcript is available in that language or if you want transcript to be redirected to a file
  • There is also the github repo if you don't want to use the website or CLI and want to self-host, then it has instructions on how you can do it. The repo can be found here: https://github.com/nilukush/youtube-transcript

The advantage of using this youtube-transcript is that:

  • It uses the most famous transcript library youtube-transcript-api
  • And since YouTube rate limits requests from this library or in general other libraries as well, it internally uses Webshare proxy so that requests are not limited by YouTube

I know it is a simple tool but I always wanted this. I looked at solutions and mostly all of them are paid solutions.

Would you want a feature that summarizes these transcripts as well? Would love to hear feedback, suggestions or bad mouthing as well, which is also a trend these days (especially on Reddit - a lot of intellectuals who love to smash and crash people).

PS: I watch a lot of YouTube videos on Spirituality and Tech. If interested you can follow me and see my subscriptions: @nilukush

Top comments (0)