Show HN: YouTube Full Text Search – Search all of a channel from the commandline (github.com)
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.
170 comments
[ 4.0 ms ] story [ 254 ms ] threadFun 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...
"Tell HN: YouTube's web UI just got even worse" - https://news.ycombinator.com/item?id=33371268
They used to have a drop down box, for oldest or most recent, when you clicked on the tab Videos for a YouTube channel. Now you will notice, it has now a "Latest" and "Popular", something that of course the algorithm will decide upon...
Briefly, new tech / markets / apps ... i.e., 'innovation' ... often 'creates' tremendous 'value'*. Money (aka capital) rushes in - there's a boom, everyone's excited: consumers are getting new products, services, conveniences, improved prices; engineers, technologists, scientists, machinists, etc. are excited - building the new tech, exploring capabilities, using it to advance research, improving precision / throughout / etc. Dopamine hits all around, vibrant 'ecosystem', everything's lively, feelings of 'changing the world', etc.
But, then, the space reaches a comparative plateau. The low-hanging fruit is exhausted. The lucky/skilled'VCs' have made their 50x+ returns (that far more than cover the various failed ventures), the technologist innovators are moving into some other space, etc.
What's left are basically the 'landlords' and their crew. There's nothing inherently wrong with that. Those are fine 'occupations' with essential (enough) functions etc. The problem is, there are pressures, with our current culture, towards unlimited growth. There's this need ... this addiction to / normalization of 'neverending exponential curves'. So, you get rent-seeking, forms of 'maximum tolerable extraction' - a sort of exploitative feudalism... Locking up of all the resources now developed in the hands of a comparative few.
There's something of a spectrum, when it comes to economic sectors / businesses, as to how naturally monopolization forms. In general, unchecked, just about any sector / business area can fairly easily trend towards one 'company' controlling everything ... there's more that could be written here, but I'm out of time right now ... [this part should probably be edited / made into a more suitable transition]
Ultimately, every time a given market reaches a certain degree of concentration, the businesses left, particularly these days, increasingly act like "Polyergus" ants, or possibly Cuckoos, or other parasites of various types - organisms that use some degree of parasitic strategies. They 'farm' the rest of us for ever-increasing amounts of 'value'. But, not like responsible farmers, more like the human species as described by A. Smith in The Matrix - "Every mammal on this planet instinctively develops a natural equilibrium with the surrounding environment but you humans do not. You move to an area and you multiply and multiply until every natural resource is consumed and the only way you can survive is to spread to another area."
That pattern is woven throughout this way overly long comment (that also desperately needs editing) ... sadly, gotta run now.
* Some of these words / phrases are so clichéd / co-opted, it's hard not to put quotes of some type around them - partly calling attention to that aspect, partly calling attention to more fundamental meaning
"Here is how platforms die: first, they are good to their users; then they abuse their users to make things better for their business customers; finally, they abuse those business customers to claw back all the value for themselves. Then, they die."
-- Corey Doctorow, https://pluralistic.net/2023/01/21/potemkin-ai/#hey-guys
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.
This is probably the best description of their business model.
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.
I know from experience that search in user reviews is very hard. Unless you really understand the review (which was tried via sentiment analysis) you cannot rank results well. But now with the new LLM models I think it would work better.
Oh, and how about setting the default account among the many I’m logged in. Or the disable auto play setting that keeps getting reset every week.
If they had serious competition, they'd have to do more to keep users, but no such competition exists.
I grant Rumble is only 1% the size of YouTube by viewership, but I think that’ll shift fairly rapidly and we can see 10% on rumble in 3 years.
My analysis https://austingwalters.com/an-analysis-on-rumble-nasdaq-rum/
To put in perspective: there’s a ton of attorneys on there, right and left wing pundits that had their channels kicked off YouTube.
They also have UFC, sports, gaming, gun channels, etc. and that seems to be where they’re trying to grow most.
That niche has ~50% of Americans and a large portion of the globe fine with it.
Put simply, as YouTube pushes out niches (guns, comedy, pundits, etc). They move to rumble. This increases the network effects on rumble and will help it grow rapidly. The more niches on rumble, the less of a need to go to YouTube. YouTube effectively kicked out the niches that half the country likes, so you’re going to get two networks. Rumble will let anyone profit off anything, provided it’s 1st amendment protected (supposedly, I have my doubts tbh). So it can build a bigger network.
More importantly, as I point out in the analysis, they’re well positioned as the large media outlets fade to take market share.
If people come to rumble for the pundits or Gun channels and stay for the sports, w.e. That’ll work well for them.
I do too. The same people I see pushing Rumble were the same people pushing Parler, which for all intents and purposes was a honey pot. Not to mention anything rooted in politics, regardless of side, will be endorsing the “right content” and punishing the “wrong content” in various ways.
Someone already mentioned Odyssey and I too am more hopeful of that platform - a decentralized platform is the best positioned to avoid political interference and censorship.
Exactly my point, they have half the support. YouTube has the other. It seems reasonable to assume a split of the networks so lots of room for rumble to grow.
Odyssey is going to be attacked by both political sides imo we have seen that already
What will really kill Rumble is the fact that they aren’t a YouTube competitor, more a small island off the coast that is mainly centered on said niche and lack the means of true innovation.
Personally I find Odysee/LBRY much more interesting. Fully open source protocol, more varied creators, transparent moderation due to a public blockchain, and P2P file distribution are all incredibly enticing features to me.
Close to no competition
How is it incomprehensible that they don't give a shit about what you want to see and only care about what's profitable to them for you to see?
Off-topic, but since I don't use YouTube and you do, in your experience, how are the auto-generated captions? Are they accurate?
I've been unimpressed by speech-to-text engines in the past, so I'm interested to hear if this is a problem that Google's managed to solve.
So sure, google can say ‘here’s a standard way to provide subtitles for a video which we’ll index’, but then that becomes a complete SEO side channel - google needs to validate that the subtitles actually match the content. And that means their bots downloading the video itself. And google really doesn’t want to go out there and argue that video needs to be downloadable by bots, because that’s the whole YouTube-dl case right there.
Spotify and YouTube are the leading examples but there are definitely others.
I have successfully Googled text in a video's transcript and found that video.
The transcripts themselves are pretty bad though (Google's using old tech).
They're usually good enough for auto-summarization though.
Google will find a video when you search for a phrase that was said in it (as long as its bad speech recognition got it right), it will find a video with a text that shows up on an object with enough clarity to OCR (for example electronic component name on a pcb in the foreground). There is one plot twist - Google will not always do it when you search for VIDEO specifically :) but will gladly give you videos when searching text/images :)
Youtube search on the other hand will try
- suggest something you liked that has nothing to do with the search term entered
- popular videos at this moment
- videos mildly related to proper results. One of them had a horse in it? clearly you want more horses!
- videos with title mildly related to search term
- to ignore upload date filter when they panic (Christchurch mosque massacre).
For example YT search for "Si5351A" limited to this month will give 11 somewhat proper results mostly with "Si5351" (no A postfix) in title/description AND some dude DXing in Indonesian "Menerima Modif Radio Yaesu FTC 1540A Ke DDS System" because "Si5351A" is a "DDS" so its the same thing right? Its like when Im looking for "NSR Ro80" you should show me plenty of other cars because Ro80 is a car :). Searching for Si5351A without quote marks will show one additional video with Si5351B in the title.
Gets better, searching Google Video for Si5351A last month also gives ~11 results, but only 4 of those are direct YT links :]
Firstly, if Google did offer this feature, it would likely be targeted by Search Engine Optimization (SEO) exploits. In essence, any time a new search parameter is introduced, there's a risk of it being manipulated to prioritize certain content—especially by those interested in gaming the system for increased visibility or monetary gain. If YouTube's search feature were to be plagued by such spamming, it could severely degrade the user experience and lead to Google having to strip it away. While not a guarantee, it's a probable outcome given the history of SEO misuse.
Secondly, YouTube's primary focus is on its recommendation algorithm rather than search functionality. With billions of videos hosted, the key goal is to keep users engaged by serving up content they're likely to enjoy, thereby increasing view times and ad revenue. The search feature, while useful, is not as integral to this objective. Further, offering full-text search could provide yet another avenue to manipulate the algorithm, which YouTube surely wants to avoid.
Finally, implementing and maintaining such a feature would require substantial resources. It would necessitate hiring teams of high-salaried employees to moderate and ensure fair use of the feature, adding considerable operational costs. Considering these factors, it seems that Google has made a strategic decision to avoid this feature for now.
That said, the fact that third-party solutions are emerging, such as the one shared here, shows that there's a demand for full-text search capabilities. It also underscores the potential that these solutions have when unencumbered by the constraints faced by a tech giant like Google. This provides a fascinating insight into the dynamic relationship between third-party developers and tech corporations and the way they can complement each other.
Maybe for some users. I just use youtube to find a specific video I need (because people have stopped writing useful how-to's now that they can just make a 10 minute video covering about 1 minute worth of text), and a full text search would be so, so useful.
FOSS dialer recommendations are welcome btw.
That is not my experience! I regularly resort to this when the crappy inbuilt youtube search, which prefers to throw out algorithmic recommendations over returning actual search results, fails to come up with the goods.
Do you really get no results for, say: https://www.google.com/search?&q=intitle%3A%22thomas+brinkma... ?
That this was the case with a company whose name is synonymous with online search was ... simply mind-boggling.
The platform eventually did get search (actually a few different implementations), which varied between mostly useless to actually reasonably functional, though I'll note that HN's Algolia-based search is vastly more useful on an ongoing basis.
G+'s content, to the extent it survives at all, is largely on the Internet Archive's Wayback Machine which ... lacks search.
if anyone could have disrupted the corrupt and unfair academic publishing world, it was Google. they just found it an uninteresting task. they preferred to work on G+, Stadia, Google Code, etc, https://killedbygoogle.com/
Also, using "site:youtube.com" on Google works perfectly for me. If I look up "site:youtube.com david letterman" it gives me the David Letterman channel, followed by a seemingly infinite number of Letterman clips. Precisely what I'd expect.
The only thing I can reproduce that you're complaining about is that Google (and YouTube) search don't seem to index YouTube user comments, in contrast to Reddit. But Google doesn't seem to index comments-attached-to-content anywhere on the internet -- not even comments on articles at mainstream publications like the New York Times. Which is probably more of a feature than a bug -- comments on both YouTube videos and news articles tend to be a lot of emotional reactions and repeated opinions which aren't worth searching at all. In contrast, many (not all) Reddit threads are often very informative and the "main content", so it makes sense Google indexes them.
So I don't really see anything to complain about here, from my perspective.
"having a distribution that's both radially symmetric" site:youtube.com
would return 3b1b's "Why π is in the normal distribution" video, which has that in subtitles at 22:28.
Even without the site: term, all I get is an allreadable.com page that's scraped the subtitles for that video. Allreadable appears at first glance to be a site owned by someone in China and hosted on liquidweb.
I wonder why YouTube indexes the transcripts for YouTube search, but Google chooses not to include them in its index for Google search? Seems like an intentional decision since it's the same company after all.
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
[0] https://github.com/ramanlabs-in/hachi
[1] https://youglish.com/
https://clipbase.xyz/
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)
1. Wizard to create a docker-compose file: https://weaviate.io/developers/weaviate/installation/docker-... (e.g. choose the embedding model)
2. Sample notebook showing how to index items using the python library: https://github.com/weaviate-tutorials/vector-provision-optio...
These numbers can be plotted as points in a space, and embeddings of things with similar meanings are plotted close to each other. So things like "exam preparation" would have embeddings close to things like "top study tips".
Say you have created embeddings for a large corpus of text (in this case all youtube captions) once. If you create embeddings for a user query, you can search for embeddings close to it, and these will be "semantically" similar to the query.
The advantage is that unlike traditional full-text search, the user doesn't need a query that includes words present in the text.
This behavior is due to the YouTube cookies consent page.
I opened an issue about this specific issue: https://github.com/NotJoeMartinez/yt-fts/issues/1
Glad if you want to help.
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?
> 7060
Running it without the grep etc says channel not found.
Below are the top 10 from just the podcast.
https://www.youtube.com/playlist?list=PLrAXtmErZgOdP_8GztsuK...
First column is "love"s per episode.
It allows searching the full text, instead of just title, description, or keywords.
I opened an issue:
https://github.com/NotJoeMartinez/yt-fts/issues/1
Hope it helps.
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...