Hacker News new | ask | show | jobs
by mmathias 3358 days ago
Well, I'm not exactly sure about how to do that. I could implement a list of all the major porn sites, but then people could still post porn URL using URL shorteners...
3 comments

Display the URL with a countdown and a prominent "no thanks" button. Redirect after the countdown if they don't opt out.

A fair amount of sites you don't want to visit have obvious urls. Or maybe you could scrape the title and display that as well.

This is actually a good point, but I'd imagine people put down a porn website out of pure impulse when trying this service, so having their URL rejected with a friendly warning would certainly reduce the amount of porn spam. You could also block common URL shorteners.

This is a really cool app though!

Steven Black's hosts compilation [1] is a good start for what to disallow. For URL shorteners, you could disallow URLs that trigger an HTTP redirect (e.g. HTTP 301), or you could follow the chain of redirects and apply your rules to the terminal URL.

[1] https://github.com/StevenBlack/hosts

If you disallow redirect, it should allow redirects to the same domain.