If you own an Android phone there is a "Digital well being" settings which allows you to block applications after a certain amount of time spent every day, it also work for time spent on certain website on chrome, and it contains other features (focus mode, black and white mode) which I've found really useful. There are equivalent browser extension for desktop
Though blocking websites/apps is not a magical solution, in the past I've found myself just disabling the blockers when I really wanted to watch something, I think it only works combined with discipline