Skip to main content

CLI tool to search youtube captions

Project description

ytgrep
-----------------------

ytgrep is a CLI tool to search youtube closed captions with a grep-like interface.


Requirements
=============

* Requires python >= 3.5

Installation
=============

.. code:: bash

pip install ytgrep

Purpose
=============
ytgrep is particularly useful whilst looking for particular topic or keywords mentioned in a video.

For example, searching for the word 'topoloigcal sort' in `MIT's Open Courseware Lecture on DFS and topological sort <https://www.youtube.com/watch?v=AfSk24UTFS8>`__:

.. raw:: html

<a href="https://asciinema.org/a/SjG0XTmIPzDfNgx2SxwhCdXwt" target="_blank"><img src="https://asciinema.org/a/SjG0XTmIPzDfNgx2SxwhCdXwt.svg" /></a>

Usage
==============

.. code:: bash

usage: ytgrep.py [-h] [-e] [-v] [-links] pattern urls [urls ...]

Flags
=============
* -e <PATTERN> - specify a regular expression to match
* -v - verbose, print debug information
* -links - include the time shortcut link with each match (see example below)


More examples
=============

Search multiple urls
.. code:: bash

ytgrep 'bananas' https://www.youtube.com/watch?v=G0PQrCwol6g


Development
=============

Run Tests
~~~~~~~~~

*Note:* Functional tests do download directly from Youtube

.. code:: bash

## All tests
python -m unittest discover

## Unit tests
python -m unittest discover test/unit

## Functional tests
python -m unittest discover test/functional

Related projects
==================
* youtube-closed-captions - This project used this library as a starting point https://github.com/mkly/youtube-closed-captions
* videogrep - get supercuts of video matching provided seach terms


TODO
============
* Supporting languages other than English
* -e '*' breaks ytgrep - appears to be applying red more than once
* Run coverage and see if any tests are missing


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ytgrep-0.4.4.tar.gz (7.7 kB view hashes)

Uploaded Source

Built Distribution

ytgrep-0.4.4-py3-none-any.whl (10.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page