Show HN: YouTube Full Text Search – Search all of a channel from the commandline (opens in a new tab)github.com
540 pointsyt-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
Fun thing to try: do a Google search with "site:youtube.com" in it. You get basically nothing, no matter what keywords you use. It seems that Google actually entirely ignores/excludes YouTube from their regular HTML indexing, and instead only relies on the YouTube backend to actively push content into (a special, separate part of) the search index. Which gets you "results from YouTube" and "video search" — but doesn't get you the ability to search youtube videos pages qua web pages. (Consider: you can find a post in a Reddit comment thread on Google. Can you find a post in a YouTube video comments section on Google?)
Heck, when I first heard about YouTube's autogenerated captions, my first thought was "oh, so this is Google building deep indexing of video through audio transcription, because they can't trust externally-provided subtitles, right?" But it's been 10 years, and I couldn't have been more wrong.
And then there’s YouTube where you can’t even search subtitles. It makes me shake my head. Google seems to be at the forefront of AI, but doesn’t seem to be able to turn all that expertise into relevant products. Maybe the recent disruptions will shake them awake?
Then again, I also find it absurd. YouTube is one of the most valuable parts of the Internet. And its lack of searchability is criminal. At least the YT search itself should make up for it. It's shame it doesn't.
If they got it set up such that in theory any web spider could come along and index a YouTube video — then there would be no anti-trust reason that Google couldn't just directly ingest the subtitle files off their own servers; it'd just be a bandwidth-saving optimization over the scraping process that they could otherwise do.
YouTube could literally be a minimal web forum with a video tag in the first post of each thread, but likely due to DRM and related motivations, they instead wrap everything in thick layers of obfuscated JS.
Comments were easily indexable too, before that was also removed: https://news.ycombinator.com/item?id=11053204
For a while there were various shady-looking sites that seemed to scrape YouTube video pages (including comments) and I could sometimes find them through Google (then going back to YouTube for the original video), but within the past few years those have unfortunately also either been delisted/censored from search results or died out.
https://www.socialmediatoday.com/news/google-tests-text-sear...
They are about keeping you engaged and keep suggesting to users what they think will keep you engaged with the platform. It's an entertainment platform not a library...
Continue this thread — 4 replies
If I was searching for how to replace part X in appliance Y or car Z, better search might get me the answer with less watch time. That’s good for me, but might hurt YT.
Continue this thread — 6 replies
https://chrome.google.com/webstore/detail/youtube-shorts-blo...
This is exactly it. It's the same business logic that is employed in the regular Google Search.
Google doesn't make money from giving you correct search results. It makes money by keeping you searching for the results you want.
a. Doing it won't get anybody a promo.
b. They've considered it and determined that it will lose revenue to a degree that is not justified by the usability improvement.
This is one of the pitfalls of having an ad-based product instead of a fee-based product. User experience is just no longer the top priority.
Allowing users to freely query content in their own websites is completely antithetical to what they are trying to do. YouTube is also very aggressive in preventing scraping and limiting the usage of the official API. Which is quite ironic considering the history of the company.
Continue this thread — 20 more replies
https://www.sqlite.org/fts5.html
I’ve not used it with enough content to know how much faster it is than LIKE ‘%my query%’ but it should be a lot quicker.
(Also, in most cases you don’t need to create an id column — every table has one already in the form of rowid.)
https://www.sqlite.org/rowidtable.html
Critically, this is per channel. I wonder if we can optionally configure this to share the downloaded transcripts to a central repository so eventually a good proportion of youtube's transcripts could be downloaded as one big text file.
Sure, are you willing to host it and handle the absolutely inevitable legal issues?
SQLite has a really power full-text search mechanism built in - FTS5. It can handle things like stemming and stop words and relevance ranking.
My sqlite-utils Python library includes helper methods for setting that up: https://sqlite-utils.datasette.io/en/stable/python-api.html#...
[1]https://github.com/NotJoeMartinez/yt-fts/pull/25 [2]https://github.com/simonw/openai-to-sqlite
All comments shown.
Couldn't load more comments. Check your connection and try again.