Merge pull request #1477 from sawanmsis/exclude_nsfw

Excluded NSFW sites by default.
pull/1502/head
Siddharth Dushantha 2 years ago committed by GitHub
commit 0ebf9c8e04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -294,7 +294,8 @@
"url": "https://pt.bongacams.com/profile/{}",
"urlMain": "https://pt.bongacams.com",
"username_claimed": "asuna-black",
"username_unclaimed": "noonewouldeverusethis77777"
"username_unclaimed": "noonewouldeverusethis77777",
"isNSFW": true
},
"Bookcrossing": {
"errorType": "status_code",
@ -369,7 +370,8 @@
"url": "https://chaturbate.com/{}",
"urlMain": "https://chaturbate.com",
"username_claimed": "cute18cute",
"username_unclaimed": "noonewouldeverusethis77777"
"username_unclaimed": "noonewouldeverusethis77777",
"isNSFW": true
},
"Chess": {
"errorMsg": "Username is valid",
@ -1385,7 +1387,8 @@
"urlMain": "https://onlyfans.com/",
"urlProbe": "https://onlyfans.com/api2/v2/users/{}",
"username_claimed": "theemilylynne",
"username_unclaimed": "noonewouldeverusethis7"
"username_unclaimed": "noonewouldeverusethis7",
"isNSFW": true
},
"OpenStreetMap": {
"errorType": "status_code",
@ -1511,7 +1514,8 @@
"url": "https://pornhub.com/users/{}",
"urlMain": "https://pornhub.com/",
"username_claimed": "blue",
"username_unclaimed": "noonewouldeverusethis7"
"username_unclaimed": "noonewouldeverusethis7",
"isNSFW": true
},
"ProductHunt": {
"errorMsg": "We seem to have lost this page",
@ -2118,7 +2122,7 @@
"urlMain": "https://www.wikipedia.org/",
"username_claimed": "Hoadlck",
"username_unclaimed": "noonewouldeverusethis8"
},
},
"Windy": {
"errorType": "status_code",
"url": "https://community.windy.com/user/{}",
@ -2178,7 +2182,8 @@
"url": "https://xvideos.com/profiles/{}",
"urlMain": "https://xvideos.com/",
"username_claimed": "blue",
"username_unclaimed": "noonewouldeverusethis7"
"username_unclaimed": "noonewouldeverusethis7",
"isNSFW": true
},
"YouNow": {
"errorMsg": "No users found",
@ -2201,7 +2206,8 @@
"url": "https://youporn.com/uservids/{}",
"urlMain": "https://youporn.com",
"username_claimed": "blue",
"username_unclaimed": "noonewouldeverusethis77777"
"username_unclaimed": "noonewouldeverusethis77777",
"isNSFW": true
},
"Zhihu": {
"errorMsg": "404",

@ -561,6 +561,10 @@ def main():
action="store_true", default=False,
help="Force the use of the local data.json file.")
parser.add_argument("--nsfw",
action="store_true", default=False,
help="Include checking of NSFW sites from default list. Default False")
args = parser.parse_args()
# If the user presses CTRL-C, exit gracefully without throwing errors
@ -624,6 +628,9 @@ def main():
print(f"ERROR: {error}")
sys.exit(1)
if not args.nsfw:
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.
@ -52,6 +52,7 @@ class SiteInformation:
self.username_claimed = username_claimed
self.username_unclaimed = username_unclaimed
self.information = information
self.is_nsfw = is_nsfw
return
@ -162,7 +163,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 +174,23 @@ 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
"""
sites = {}
for site in self.sites:
if self.sites[site].is_nsfw:
continue
sites[site] = self.sites[site]
self.sites = sites
def site_name_list(self):
"""Get Site Name List.

Loading…
Cancel
Save