I generally haven’t done too much with Google’s API offerings because the ones I’m interested in are expensive, so I was surprised when I checked YouTube’s API and it was free. After I thought about it, though, it made sense: when you search YouTube’s site, you stay on YouTube to view the content — you’re not going off to some external site where Google can’t get your eyeballs for ads. So why not make that functionality free?
Earlier this week I tried putting together Wikipedia and YouTube to see if I could trace suddenly-popular Wikipedia topics to AI-generated slop on YouTube. (I wrote about it here.) That was interesting enough that I decided to see if I could make a general YouTube search that build queries off Wikipedia pages.
It worked really well! I was pleased how I could easily create different levels of query complexity using different parts of the Wikipedia API offering. And between Wikipedia article footnotes and Gossip Machine, I got two types of date-based search that brought useful results.
Basic Mashing
Everything starts with a basic Wikipedia keyword search. That search gives you a list of results with a brief description. When you click on one is when you start unfolding more options.
When you select a result from the initial search, it expands to show a brief description (or in Boeing’s case not so brief) along with a cloud of relevant words mechanically (without AI) extracted from the page text. (It’s not a great cloud at the moment because I need to put in a better list of stopwords to filter out common terms.) Clicking on any of the terms adds them to the YouTube search. When you got the query just how you like it you can click the red search button and hey presto, YouTube videos.
I like this for basic topic searches, things I’m absolutely unfamiliar with. A Wikipedia keyword search gives me some background and a set of general but relevant keywords to build a query. Once I’ve run a search, I can tweak the results I’m looking at with the result filters. What you’re seeing changes a lot when you specify that you want videos of at least 10 minutes with at least 10,000 views, for example.
But you may not feel that’s enough for your search needs. You may want to use keywords that are more specific than what you’d get in even a properly-stopworded cloud, or you may want to do more reading on the topic. You can by going one level deeper into the Wikipedia information.
It’s a little hard to see but there are a couple of small squares to the right of the “Boeing” header on the Wikipedia side. When you click on the one nearest the header the entire Wikipedia page loads.
More Specific Search
The tag cloud remains over the loaded Wikipedia page, so you can still use those general terms, but you can also highlight any part of the entire Wikipedia page and click the “Add Query Term” button to use it in a YouTube search.
Pulling query terms out of full Wikipedia page text is useful (and can drop you into some turbo-powered rabbit holes if you’re not careful.) But I wanted to do more with the full Wikipedia page than just add some query terms. I wanted to try some date-based YouTube searching with those sweet Wikipedia footnotes!
Date-Based Searching Using Wikipedia Footnotes
Clicking on a Wikipedia footnote with this search does not take you to the end of the Wikipedia page and the citation. Instead, the date in the citation is used to create a date-bounded search in YouTube (citation date plus seven days). The citation itself is turned into a tag cloud for building the query.
I like this feature a lot if I do say so myself. A lot of news outlets make their content available on YouTube, but it’s hard to find sometimes among all the other YouTube content that’s more calibrated for the platform (louder thumbnails, tweaked and tested headlines, etc.) By building a search around a date and a particular event, you can get right to it.
Of course, a Wikipedia page is going to have only so many footnotes, and only so many of them are going to be relevant to YouTube’s lifespan. So I wanted to add another way to do date-based YouTube searching with Gossip Machine.
Gossip Machine for More Date-Bounded Searching
Gossip Machine is something I made a couple of years ago and sometimes add to my projects for date-based searching. It analyzes Wikipedia pages for dates with especially-high page views and, in this case, turns them into YouTube searches. Just use the date form to specify the time span you want to search (Wikipedia’s page logs go back to 2017) and you’ll get a dropdown menu of high-view dates along with some viewing data:
Choose a date from the dropdown menu and it’s turned into a date-based YouTube search which renders often-useful results which you can filter to your heart’s content.
Should I put this on GitHub? I’ve never done that with a Node project before.