ray-lothian / Block-Site

A browser extension to block website access using hostname matching
https://add0n.com/block-site.html
Mozilla Public License 2.0
227 stars 43 forks source link

keyword blocking #78

Open ghost opened 2 years ago

ghost commented 2 years ago

any plans of implementing this?

example: if the word porn exists on the page (page title or content), block it.

imkaihao commented 2 years ago

@mrjayviper Maybe you can try LeechBlock. See https://www.proginosko.com/leechblock/faq/keywords/ for details.

Elliot-TS commented 2 years ago

You can block keywords in the URL using Regular Expressions. For example, to block any URL with "HelloWorld" in it, you would add:

R:.HelloWorld.

The R: tells it that this rule is a regular expression. The . means "match any character," and the modifies it to mean "match zero or more of any character." Then the "HelloWorld" part tell it to match the words HelloWorld, and the . once again means to match zero or more of any character. So altogether, it says to block any URL that starts with any number of random characters, has HelloWorld somewhere in the middle, and then has any number of random characters at the end. Note that it will also work if the URL ends in HelloWorld because .* matches zero or more characters.

If you want to try crafting your own Regular Expressions to block more types of words, check out regexr.com/ it has a reference of all the things you can do with Regular Expressions, and it lets you tinker with them to get it to block whatever patterns you want. Just note that Lookarounds don't work in Block Site, but that's an advanced feature of regular expressions, so you probably won't have to worry about that.

teamadvil commented 1 year ago

I must be doing something wrong. I'm blocking .zip and .mov TLDs which works fine.

However, if I search (using Google or DuckDuckGo, etc) with any word containing "zip" or "mov", the search page is blocked! Not a hostname - but any text containing those characters.

Does this make sense? Any ideas?