Open dabukalam opened 3 years ago
Sure, seems like a good feature... PRs welcome ;)
How I'd go about this would be something like:
blacklist: Vec<Url>
field to the configuration settings struct. Serde will then automatically verify any specified urls on configuration load.However this would then have to be an exhaustive list of URLs you want to black list, providing a domain probably wouldn't black list all urls under this domain, for example. That would require some more thought.
I guess one simple solution could be to have separate e.g. blacklisted_urls
and blacklisted_domains
configuration fields.
Then in the resolve function you could check whether blacklisted_domains
contains url.domain()
and bail if so.
Originally I thought maybe Url
might itself have a contains()
method, so you could identify whether the current url's path contains the blacklisted URL, but a quick look suggests not.
It would be good to be able to specify a list of URLs that one doesn't want url-bot to resolve.