Skip to content

alexkohler/ytgrep

Repository files navigation

ytgrep

image

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

Requirements

  • Requires python >= 3.5

Installation

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:

image0

Usage

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

Include timestamped links (e.g. <youtube URL>/&t=196s) to jump directly to part in video where keyword was mentioned.

$ ytgrep -links 'potassium' https://www.youtube.com/watch?v=OIYOshsEqmQ

Search with regular expression

ytgrep -e 'banana|potassium' https://www.youtube.com/watch?v=OIYOshsEqmQ

Search multiple urls

ytgrep 'banana' https://www.youtube.com/watch?v=LH5ay10RTGY https://www.youtube.com/watch?v=zFQWVN4xip0

Development

Run Tests

Note: Functional tests do download directly from Youtube

## All tests
python -m unittest discover

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

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published