Lurker News
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.

Comments (165) 32 threads

Earlier comments
lopatin1 reply#
This will come in handy. I’ve always wanted to count how many times Lex Fridman has referred to something as a beautiful dance.
noman-land1 reply#
I want to do a word count on the word "love".
notjoemartinez3 replies#
> yt-fts search "love" --channel "Lex Fridman" | grep "love" | wc -l

> 7060

lopatin#
Legend
noman-land#
This comment blew my mind.
noman-land1 reply#
Update, I couldn't get this to work. It returns 0 for me.

Running it without the grep etc says channel not found.

Continue this thread — 1 reply

expertentipp2 replies#
I think I'll start to use exclusively CLI tools for discovering and downloading of YT content. The entire experience which starts from typing "youtube.com" in the address bar and pressing enter is obnoxiously unbearable.
hackernewds2 replies#
Downloading? Do you also not believe creators should be compensated for their content?
galleywest200#
I already block advertisements on the web, so I see none when on a Desktop web version of YouTube. But I do not use Sponsor Block so those creators still get to show me their ExpressVPN ads or whatever the flavor is today. Also I use Patreon.
smcleod#
I think they should be compensated, but I don't think Google should be.
harlanji1 reply#
I hate being the poo pooer who says that subtitles are available via the API and wish the tool went that route.

I'm all for stuff being archivable with tools like youtube-dl, but I much prefer to see tools like this use the API despite its quotas because it goes beyond archiving a copy for reference. Tools that (ab)use scraping only justify anti-scraping efforts that journalists and the like use and escalate that arms race. I think one could still scrape a channel or two per day within API usage limits [1]--50 units per list, 200 units per download; quota 10,000 units per day.
[1]: https://developers.google.com/youtube/v3/docs/captions/downl...

tonto#
agree that using the API is likely the nicer route. you can also apply for a quota increase, I recently applied for youtube API quota increase to 100,000 units and it was approved for my app (https://cmdcolin.github.io/ytshuffle/) I was concerned they wouldn't like that the app downloads so much data but it was approved without much question, they just wanted terms of service prominently displayed to end users
ggerganov1 reply#
For videos without subtitles one could chain Whisper to auto-generate transcripts, though that would require downloading the audio and processing it
cced1 reply#
This is exactly what I’ve built. Nothing fancy just ytdlp + whisper + ripgrep + fzf and I’ve got a pretty interesting way to ctrl+f my YT history.
gukoff1 reply#
Mind to share? I'd like to try this out
zdwolfe#
Not OP, but I too wrote something nearly identical with whisper so I could creep on old EthosLab videos. Here's the gist:

from pytube import Channel
import whisper
channel_yt = Channel(channel_url)
video_yt = channel_yt.videos[0]
video_yt_stream = video_yt.streams.filter(mime_type="video/mp4").filter(res="720p").first()
video_yt_video_file_path = video_yt_stream.download()
audio = whisper.load_audio(video_yt_video_file_path)
model = whisper.load_model("tiny")
transcript = model.transcribe(audio)

Load more comments