| Clickbait detector
Using YouTube thumbnails to create a clickbait detector using MobileNetV3.
Apr

Introduction

YouTube is an amazing site, but it’s not without flaws. One of the things I’ve grown irritated with is the use of clickbait tactics in videos which arguably shouldn’t have them. By clickbait I mean things like:

Typical
Red (or yellow) arrows and open mouths as far as the eye can see.

Also these ubiquitous red circles:

Circles
Because we wouldn’t know where to look otherwise.

YouTube’s algorithm is pretty good if you make sure to never stray too farr from things you like. If you do get curious and start clicking on videos like the above, it will take ages to get back on track. It’s probably just me being old, but I don’t like the shocked face, open mouth YouTube thumbnails. That aesthetic is fairly common in a certain subset of videos, like reaction vids and things looking to stoke controversy, but it also bleeds over into things I search for, like here:

Coding
There’s not even a watch.

I’ll get things like Top 10 reasons Rust is better then C and Is drum and bass dying?, with an image of a Pikachu-faced DJ. For the most part I will diligently click that I don’t want to see that channel or content like that and the algorithm does a decent job of removing it. And though that’s the easy fix, why should I take that route when I can overcomplicate things with code?

The solution

I haven’t yet completed the browser extension, but I’m going to do that in the next few weeks when I can get another chunk of time to focus.

These tools, which create the model for the plugin, will work for classifying any set of images, though you’ll need to adjust the database and query script if you want to use something other than YouTube thumbnails. The repo has all the set up information, while here I give an overview.

The project consists of four different scripts:

  1. query: uses search terms to query the YouTubeAPI which returns thumbnail links.
  2. scrape: downloads the thumbnail images.
  3. classify: simple tkinter window used to classify images.
  4. train: train our model

All these are dependent on the output.sqlite database.

In building this, I found my primary restriction was the YouTubeAPI, which states you get 10,000 queries a day, but what constitutes a query is a little odd. It seems that the 10,000 is your max credits per day and each request takes anywhere from 10-20 queries. I was able to get in approximately 100 requests per day before I’d max out. Each request would get me 10 thumbnails, so I can get about 1000 images a day on the free plan.

The classifer is the simplest tkinter app I could make, and there were a few times when I misclicked and had to manually update the database. I should probably add forward and back buttons, along with an indicator of what the image is currently classified as.

Classify
The barest of bare. Press a key, classify an image.

Manually classifying is tedious, so the next step is to get the classifer up to snuff and have it do a preliminary classification of new images, assigning those with high probability and leaving the rest to me. Right now it’s at about 75% accuracy, but the dataset is only a thousand images as of writing this post, and I’ve done little in the way of optimizing.

At present, I’ve use the base model with weight decay and dropout, but need to add args for the script to make things adjustable. I think there’s still plenty to do to get better results, but the most important thing is likely more data.

The next steps are to continue to collect data and train up the model while building the browser extension.