I found that the main reasons I spent hours online are time wasters. This moments before sleep or waking up, eating, commercials, etc. And then this couple of time wasting minutes end up hours sometime. I understand.
My best solution was finding either more productive time wasters (like convincing myself to clean the house a bit), or time wasters that let you know how much time you’re wasting. I found that Uncle John’s Bathroom Readers full the void with silly and useless-fact articles like reddit would, but there isn’t an endless amount of click-bait titles to scroll through and catch your attention for more than a couple reads. You waste the perfect amount of time and aren’t stuck in a hole.
And if you do have more than enough time for just a couple articles, find a real hobby. Like a real book, movie, video game, or work of some kind.