I have unfortunately found myself doing more and more of this
And I've not been working diligently.The soul of the sluggard craves and gets nothing, while the soul of the diligent is richly supplied.
Discipline only gets one so far I've found. Over the course of weeks, months, it became very easy to fill lulls in my work with youtube or other sites of similar time-wasting nature.
Here is what I've done to help myself so far, and I will reply with updates
Blocking Bad Sites at Router Level
I set-up OpenWRT on my router and made blocks there.
1. Under "Network", "DHCP and DNS", and then under "DNS Forwardings" you can force certain websites to resolve to a certain DNS server with the syntax of "/baddomain.com/192.168.13.13"
Just set the IP to one that doesn't exist on your network and tada! All the bad sites will no longer resolve.
2. HOWEVER many browsers support Domain over HTTPS (DoH) which totally circumvents this method. So in addition to the blocking of bad domains, we'll also block DoH providers. Now theres like a thousand domains here that need to be blocked and we can't do that manually under DNS forwardings, so instead
a. Under Applications, download "adblock" and "luci-app-adblock"
b. Under "Services", "Adblock", enable "Force local DNS" and set it to port 53 (OpenWRT has its own DNS running under 53)
c. Click "Edit Blacklist" and paste all entries from github.com/hagezi/dns-blocklists/main/domains/doh.txt
d. Save, go back to the "Status" page under Adblock, and hit "Refresh". This will reload all the lists.
Blocking Bad Sites at Host Level
1. So this is very well and good for the general case. However, when you use a VPN, DNS is resolved by the VPN (Like it should!). And on one of my machines I pretty much am always VPN'd. So to not fall to the same bad habits of reflexively typing youtube.com in my browser when on this one, I applied host level blocks.
a. In /etc/hosts (assuming a linux host) just put "127.0.0.1 baddomain.com" and now even while VPNd the bad sites wont resolve.
b. To add a little bit more friction so I just dont remove these entries when bored, "chattr +i /etc/hosts" will make the file immutable
c. In addition to this, I installed the "Redirector" extension in my browser and added entries for each of the bad domains to redirect to duckduckgo.com
So this was an afternoon of effort. But the cause of this problematic habit is because its just so easy to mindlessly scroll on Youtube. It requires no effort and no thought to end-up throwing hours of your day away. The hope here is that in order to access these bad domains, I'd have to jump through so many hoops that it just wouldn't be worth it.
I will see how things go for the next week and reply with my update