How it works
When you visit a YouTube video, it will check the database to see if anyone has made any submissions for the video. If so, the sponsored segment will automatically get skipped when you reach 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 (this can be disabled in the options).
Upvotes are considered in an interesting 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.
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. 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 make sure to hit the submit button when you're finished.
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, and a hashed version of your user ID is stored. 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. By default, upvotes are made automatically when a sponsor is viewed. This can be disabled in the options.
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 2019, 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. 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 here. 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.
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
Logo by @munadikieh
The awesome Invidious API is used to grab the time the video was published.