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

Skip content filter for explicitly chosen targets #2106

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions sherlock/sherlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ def main():
action="append",
metavar="SITE_NAME",
dest="site_list",
default=None,
default=[],
help="Limit analysis to just the listed sites. Add multiple options to specify more than one site.",
)
parser.add_argument(
Expand Down Expand Up @@ -725,13 +725,13 @@ def main():
sys.exit(1)

if not args.nsfw:
sites.remove_nsfw_sites()
sites.remove_nsfw_sites(do_not_remove=args.site_list)

# Create original dictionary from SitesInformation() object.
# Eventually, the rest of the code will be updated to use the new object
# directly, but this will glue the two pieces together.
site_data_all = {site.name: site.information for site in sites}
if args.site_list is None:
if args.site_list == []:
# Not desired to look at a sub-set of sites
site_data = site_data_all
else:
Expand Down
5 changes: 3 additions & 2 deletions sherlock/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def __init__(self, data_file_path=None):

return

def remove_nsfw_sites(self):
def remove_nsfw_sites(self, do_not_remove: list = []):
"""
Remove NSFW sites from the sites, if isNSFW flag is true for site

Expand All @@ -186,8 +186,9 @@ def remove_nsfw_sites(self):
None
"""
sites = {}
do_not_remove = [site.casefold() for site in do_not_remove]
for site in self.sites:
if self.sites[site].is_nsfw:
if self.sites[site].is_nsfw and site.casefold() not in do_not_remove:
continue
sites[site] = self.sites[site]
self.sites = sites
Expand Down