I like the 10-10-10 rule "How will I feel about this decision (use of time) 10 hrs from now, 10 months, 10 years."[1] I like to add "10 seconds" because something might feel good in 10 seconds, but screw my sleep or work up tomorrow.
I'm not sure this is really about "The Internet" FWIW. The "Internet" is so broad, it now encompasses almost every life activity. Video call with long lost friend isn't the same as frittering away hours on dumb Youtube videos. Also learning a new hobby on Youtube isn't the same as frittering away hours on social media. Or doing too much work online might be "productive" but toxic to your mental health.
1 - https://medium.com/the-authentic-man/how-to-make-better-deci...
I stopped using Twitter. I have uninstalled Facebook/Messenger/Instagram from my phone. I don’t use Snapchat/Tiktok.
I subscribe to two newspapers (online), and try to read articles in full instead of just skimming.
I use Facebooks mainly for interest groups. E.g. network stuff, local history groups, train stuff, food/recipes etc. I try to avoid becoming upset in discussions, even when I vehemently disagree with people.
I never scroll around aimlessly on Reddit, I use it only for searching for specific info and asking questions.
I also read magazines (The Economist) and books, so that not all my reading is in front of a screen.
I don't have a magical answer to your question but one thing I started doing when focusing on programming is a music playlist for programming - chill, electronic, music. I lose track of time.
I think the other thing I need to do with hobbies is actually do the hobby instead of reading/watching videos about the hobby. Need to let my activity dictate what I want to enrich that hobby with later. My example is woodworking - I sub to quite a few channels and there is always something new posted. The ones that walk thru a project are neat but if I'm not doing the project then its the same as watching any random TV show at that point.
I also will stream videos for entertainment, but I try to make that a deliberate choice, not just a habit to do whenever nothing is going on in the evenings.