Skip to main content

yt-fts is a simple python script that uses yt-dlp to scrape all of a youtube channels subtitles and load them into an sqlite database that is searchable from the command line. It allows you to query a channel for specific key word or phrase and will generate time stamped youtube urls to the video containing the keyword.

Project description

yt-fts

yt-fts is a simple python script that uses yt-dlp to scrape all of a youtube channels subtitles and load them into an sqlite database that is searchable from the command line. It allows you to query a channel for specific key word or phrase and will generate time stamped youtube urls to the video containing the keyword.

Installation

pip

pip install yt-fts

from source

git clone https://github.com/NotJoeMartinez/yt-fts
python3 -m venv .env
source .env/bin/activate
pip install -r requirements.txt
python3 -m yt-fts

Dependencies

This project requires yt-dlp installed globally. Platform specific installation instructions are available on the yt-dlp wiki.

pip

python3 -m pip install -U yt-dlp

MacOS/Homebrew

brew install yt-dlp

Windows/winget

winget install yt-dlp

Usage

Usage: yt-fts [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  delete    delete [channel id]
  download  download [channel url]
  export    export [search text] [channel id]
  list      Lists channels
  search    search [search text] [channel id]

download

Will download all of a channels vtt files into your database

yt-fts download "https://www.youtube.com/@TimDillonShow/videos"

--channel-id [channel_id]

If download fails you can manually input the channel id with the --channel-id flag. The channel url should still be an argument

yt-fts download --channel-id "UC4woSp8ITBoYDmjkukhEhxg" "https://www.youtube.com/@TimDillonShow/videos" 

--language [en/fr/es/etc..]

Specify subtitles language

yt-fts download --language de "https://www.youtube.com/@TimDillonShow/videos" 

--number-of-jobs [num_threads]

Speed up downloads with multi threading

yt-fts download --number-of-jobs 6 "https://www.youtube.com/@TimDillonShow/videos"

list

List all of your downloaded channels

yt-fts list

output:

Listing channels
channel_id                channel_name         channel_url
------------------------  -------------------  ---------------------------------------------------------------
UC4woSp8ITBoYDmjkukhEhxg  The Tim Dillon Show  https://www.youtube.com/channel/UC4woSp8ITBoYDmjkukhEhxg/videos

search

Search a channel for text based off the channel id you give it and print a url to that point in the video. The search string does not have to be a word for word and match is limited to 40 characters.

yt-fts search "text you want to find" [channel_id]

Ex:

yt-fts search "life in the big city" UC4woSp8ITBoYDmjkukhEhxg 

output:

The Tim Dillon Show: "164 - Life In The Big City - YouTube"

    Quote: "van in the driveway life in the big city"
    Time Stamp: 00:30:44.580
    Link: https://youtu.be/dqGyCTbzYmc?t=1841

Search all channels

Use --all to search all channels in your database

Ex:

yt-fts search "text to search" --all

Advanced Search Syntax

The search string supports sqlite Enhanced Query Syntax. which includes things like prefix queries which you can use to match parts of a word.

Ex:

yt-fts search "rea* kni* Mali*" UC4woSp8ITBoYDmjkukhEhxg 

output:

The Tim Dillon Show: "#200 - Knife Fights In Malibu | The Tim Dillon Show - YouTube"

    Quote: "real knife fight down here in Malibu I"
    Time Stamp: 00:45:39.420
    Link: https://youtu.be/e79H5nxS65Q?t=2736

Export

Similar to search except it will export all of the search results to a csv with the format: Channel Name,Video Title,Quote,Time Stamp,Link as it's headers

yt-fts export "life in the big city" UC4woSp8ITBoYDmjkukhEhxg 

You can export from all channels in your database as well

yt-fts export "life in the big city" --all

Delete

Will delete a channel from your database

yt-fts delete [channel_id]

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

yt-fts-0.1.9.tar.gz (10.3 kB view hashes)

Uploaded Source

Built Distribution

yt_fts-0.1.9-py3-none-any.whl (9.9 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