Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black listing in DBW batch-gen #328

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions frontera/worker/components/batch_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from collections import defaultdict
from logging import DEBUG

from bigbot_common.fingerprint import suffix_list

from frontera.exceptions import NotConfigured
from frontera.utils.url import parse_domain_from_url_fast
from . import DBWorkerThreadComponent
Expand Down Expand Up @@ -103,8 +105,9 @@ def _is_domain_blacklisted(self, request):
_, hostname, _, _, _, _ = parse_domain_from_url_fast(request.url)
if hostname:
hostname = hostname.lower()
if hostname in self.domains_blacklist:
self.logger.debug("Dropping black-listed hostname, URL %s", request.url)
second_level = suffix_list.get_public_suffix(hostname)
if second_level in self.domains_blacklist or hostname in self.domains_blacklist:
self.logger.debug("Dropping black-listed URL %s", request.url)
return True
return False

Expand Down