SponsorBlock

Created By Ajay Ramachandran

SponsorBlock is a crowdsourced browser extension to block sponsor segments of YouTube videos. Users submit when sponsor happen to the extension, and the extension automatically skips sponsors it knows about. It also features an upvote/downvote system with a weighted random based distribution algorithm.

There are currently users who have submitted sponsors, which have saved a total of days of people's lives.

Download for Chrome or Firefox

The source code is fully open and the database can be downloaded by anyone. I want to keep this as open as possible!

Check out the top users here!

Come contribute, make some suggestions and help out in the Discord: https://discord.gg/QnmVMpU

News and Changelogs

Read the news here.

How it works

When you visit a YouTube video, it will check the database to see if anyone has made any submissions for this video. If so, the sponsored segment will automatically get skipped when you reach it.

Image of the notice you receive (you can disable it)

Once the sponsorship is skipped, you can report this sponsorship and it will be recorded in the database. If you don't report it, it will automatically be treated as an upvote.

Upvotes are considered in a very interresting way. Instead of just sending the top reported time, it uses an algorithm that is a little more complex, since some videos will have more than 1 sponsorship message. It will looks for all the "similar sponsors" (I'm using the word similar here like it is used in the term similar triangle). For each similar sponsor, only one will be sent to the user. A similar sponsor is one that is contained in eachother, so probably just similar times and one is slightly off.

Fancy vote distribution algorithm

In a system like that, one sponsor would get a few votes, and then the rest of the sponsors would never appear again, and could never get votes. I decided on using a more fancy algorithm that used a weighted random distribution based on a square root function. This formula makes small amount of votes (under 10), matter a lot, and makes the really large votes slowly not matter as much. This makes a newly submitted sponsor time always possible to be sent out to users to get votes. So, most users will get the best submission, but some users will get lesser votes submissions so that they can either be upvoted or downvoted. Submissions with less than -2 votes are ignored entirely.

You can read more about my algorithm here.

Submissions

Anyone can submit sponsors, either by clicking on the button that is added to the YouTube player or by opening the extensions popup. The button in the YouTube player can be hidden if you would like. You click once to indicate the start of a sponsor, then click again to indicate the end. You can report as many sponsors as there are in the video. Just hit the submit button to submit.

What data is stored?

The bare minimum. Everything stored can be downloaded from the link above if you want to see.

When you submit a sponsor, a few things are stored. The data for the sponsor, the video id are stored. Also, a hashed version of your user ID is stored with it. Your user ID is a randomly generated UUID generated by your browser. As well as these, a hashed + salted (5000 times) version of your ip address is saved. This is to be able to rate limit one ip sending way too much spam. Why is this hashed? This just adds an extra layer of security if there is a database breach. After hashing it this many times, it becomes extremely difficult to reverse it and find what your actual IP address is, but I can still verify that the current connection is from that hashed ip. By hashing it 5000 times and salting it, brute forcing would take longer to do.

When you vote, your user ID and hashed ip is stored along with what you voted for.

As well as these, whenever you submit a sponsor, it tells the server and the server records one "view" on that sponsor. No IP data or userId data is collected for this. This is to make it so that you can see how many people you have helped and I can see how much the extension is being used. However, I perfectly understand why someone wouldn't want this data logged, so there is an option to disable this if you would like.

Previous projects like this

In January, a group of people tried to do a similar thing, but instead of using other people's submissions to skip sponsor segments for everyone, they ran the data through a neural network. Here are their projects. Sadly, this project was abandoned.

I don't want something similar to happen to this project, that's why all this code is open-sourced and, most importantly, the database can be downloaded by anyone. The database may even be automatically backed up by archive.org! The database will always be available at https://sponsor.ajay.app/database.db. It is a sqlite database and can be opened in any sqlite database reading program. Certain sensitive info is not in this database and is not public such as individual votes (not vote counts) and IP addresses. That information isn't needed by anyone anyone, only the server.

When was this started

The project was started July 5th 2019 and was first released to the public July 26th 2019.

Contact Info

If you have any suggestions, feel free to tell me.

You can find all my progress updates here: https://sponsor.ajay.app/news

You can contact me by email at dev @ ajay.app if you have any questions.

Feel free to join this Discord: https://discord.gg/QnmVMpU

Or follow on Twitter: https://twitter.com/SponsorBlock

Credit

Logo by @munadikieh

The awesome Invidious API is used to grab the time the video was published.

Some icons made by Gregor Cresnar from www.flaticon.com and are licensed by CC 3.0 BY

Some icons made by Freepik from www.flaticon.com and are licensed by CC 3.0 BY