Excluded NSFW sites by default.

pull/1477/head
Sawan Mehta 2 years ago
parent a59fd5438d
commit ce4efb564d

File diff suppressed because it is too large Load Diff

@ -556,6 +556,10 @@ def main():
action="store_true", default=False,
help="Force the use of the local data.json file.")
parser.add_argument("--nsfw", "-n",
action="store_true", default=False,
help="Include checking of NSFW sites from default list. Default False")
args = parser.parse_args()
# Check for newer version of Sherlock. If it exists, let the user know about it
@ -616,6 +620,13 @@ def main():
print(f"ERROR: {error}")
sys.exit(1)
print("")
if args.nsfw:
print("Including NSFW sites")
else:
print("Excluding NSFW sites")
sites.remove_nsfw_sites()
# 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.

@ -8,7 +8,7 @@ import requests
class SiteInformation:
def __init__(self, name, url_home, url_username_format, username_claimed,
username_unclaimed, information):
username_unclaimed, information, is_nsfw):
"""Create Site Information Object.
Contains information about a specific website.
@ -53,6 +53,8 @@ class SiteInformation:
self.username_unclaimed = username_unclaimed
self.information = information
self.is_nsfw = is_nsfw
return
def __str__(self):
@ -162,7 +164,9 @@ class SitesInformation:
site_data[site_name]["url"],
site_data[site_name]["username_claimed"],
site_data[site_name]["username_unclaimed"],
site_data[site_name]
site_data[site_name],
site_data[site_name].get("isNSFW",False)
)
except KeyError as error:
raise ValueError(
@ -171,6 +175,18 @@ class SitesInformation:
return
def remove_nsfw_sites(self):
"""
Remove NSFW sites from the sites, if isNSFW flag is true for site
Keyword Arguments:
self -- This object.
Return Value:
None
"""
self.sites = {site:self.sites[site] for site in self.sites if not self.sites[site].is_nsfw }
def site_name_list(self):
"""Get Site Name List.

Loading…
Cancel
Save