For most people their brain craves stimulation. When we introduce highly stimulating and rewarding activities like YouTube, video games, and social media our brains procrastinate the harder work like programming because an easier reward is achieved by watching YouTube (ie. Less energy is expended to produce the same dopamine response).
The cycle of YouTube, social media, and video games (or anything you're addicted to) can easily ruin your life because you get caught in a loop of not wanting to work (procrastination), so you watch YouTube. That creates a habit of watching YouTube and the brain optimizes itself for that. Every time you sit at the computer you have the urge to watch Youtube. Then you start to feel bad about not making progress on your work. You turn to YouTube to make yourself feel better because it's the most efficient way of producing a reward in the brain. After each video is over, you don't want to start work because you've already optimized for watching YouTube (ie. momentum). So, you tell yourself lies like "one more video", or "after the next one I'll start work", or "well it's already 4pm so the day is basically over anyways I can't start working now".
If you're really having trouble and want a solution, block all of the distracting things in your life and get back to the basics. You don't need a "dopamine detox" or anything complicated. Simply block things (using a browser extension or DNS blacklist) you don't want to be doing and let yourself either be bored or do the work.
Suddenly you will find it's easy to get started on work, and actually pretty enjoyable to be productive. Use that momentum, and keep off of distracting websites/apps.
Do it for 5 days and see how far you can get.