Giter Club home page Giter Club logo

yt-ttml2txt's Introduction

yt-ttml2txt

Note to GitHub users : development is happening on GitLab, please go there if you want to open issues or submit merge request.

Converts a Youtube TTML subtitle file to a text file.

Install

make                                 # build with gcc
sudo make install                    # install in /usr/local/bin/

# Alternatives
make CC=clang                        # build with an other compiler, here clang
sudo make install PREFIX=/usr/bin/   # install in an other place, here /usr/bin/

Usage

yt-ttml2txt [-1] <file>

Converts a TTML subtitle file to a text file, written on STDOUT.

Options:

`-1`: print all in one line (eg to facilitate grepping).

Note that this is very simple parsing tested only against Youtube's TTML files and probably only working with them.

My goal is not to fully support any valid TTML file, just what Youtube produces. If this simple parsing turns out to be unstable, I'll rewrite it into a full blown AST parser.

Why?

I wrote this to be able to dump text content for Youtube videos and then grep them, providing local full text search for Youtube videos I care about. Here is how I do it (you need yt-dlp or similar for that):

yt-dlp --skip-download --write-auto-sub --sub-format ttml <youtube-video-url>
yt-ttml2txt -1 <ttml-file> > <cache_dir>/<ttml-file.txt>
grep -r "<your query>" <cache_dir>/

You now can grep your favorite videos content locally for the low price of a few text files in storage.

Credits

This idea came after reading Jeff Atwood mention his use of Youtube subtitles to access content.

yt-ttml2txt's People

Contributors

oelmekki avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.