Social media is designed to take advantage of the reward systems of the brain. For this reason, we should not feel too guilty for getting drawn into social media for long periods of time - the resources behind social media are immense.
YouTube in particular is great at doing this. Every video that you watch has recommendations along the side bar. Recommended videos are even automatically played when you finish a video. All of this is carefully designed to keep you on YouTube for as long as possible.
Like many, YouTube became a huge time sink for me. I would constantly be going down rabbit holes, opening up recommended videos in new tabs, and repeating this for each new video that I watched. The number of tabs that I would open would grow exponentially.
Last year, I discovered a browser plugin called Unhook - Remove YouTube Recommended Videos, which blocks all of the distractions that are built into YouTube. It hides the recommended videos, the home page, and even hides the video annotations that often come up at the end of a video recommending other videos.
In the context of the habit loop, this plugin blocks all of the cues that you get on YouTube that trigger the habit of clicking on new videos and spending hours going down rabbit holes. By removing this cue, it became a lot easier for me to control this habit and not spend hours on YouTube unintentionally. This is very similar to how News Feed Eradicator works, and is effective for the same reasons.
I am now more mindful of how I use YouTube, only watching videos that I originally intended to watch. I am able to focus more, and get more out of each video, rather than constantly being distracted.