diff --git a/classes/make_settings.py b/classes/make_settings.py index 0d09624bc..75b1ff33a 100644 --- a/classes/make_settings.py +++ b/classes/make_settings.py @@ -103,6 +103,8 @@ def update_site_settings(options) -> dict: new_options["filename_format"] = value.replace("{username}","{model_username}") if "metadata_directory_format" == key: new_options["metadata_directory_format"] = value.replace("{username}","{model_username}") + if "blacklist_name" == key: + new_options["blacklists"] = [value] return new_options class Supported(object): @@ -172,8 +174,8 @@ def __init__(self, option={}) -> None: 'ignored_keywords', []) self.ignore_type = option.get( 'ignore_type', "") - self.blacklist_name = option.get( - 'blacklist_name', "") + self.blacklists = option.get( + 'blacklists', "") self.webhook = option.get( 'webhook', True) diff --git a/modules/onlyfans.py b/modules/onlyfans.py index a7f637914..073d10bcb 100644 --- a/modules/onlyfans.py +++ b/modules/onlyfans.py @@ -46,13 +46,13 @@ date_format = None ignored_keywords = [] ignore_type = None -blacklist_name = None +blacklists = [] webhook = None text_length = None def assign_vars(json_auth: auth_details, config, site_settings, site_name): - global json_config, json_global_settings, json_settings, auto_media_choice, profile_directory, download_directory, metadata_directory, metadata_directory_format, delete_legacy_metadata, overwrite_files, date_format, file_directory_format, filename_format, ignored_keywords, ignore_type, blacklist_name, webhook, text_length + global json_config, json_global_settings, json_settings, auto_media_choice, profile_directory, download_directory, metadata_directory, metadata_directory_format, delete_legacy_metadata, overwrite_files, date_format, file_directory_format, filename_format, ignored_keywords, ignore_type, blacklists, webhook, text_length json_config = config json_global_settings = json_config["settings"] @@ -75,7 +75,7 @@ def assign_vars(json_auth: auth_details, config, site_settings, site_name): date_format = json_settings["date_format"] ignored_keywords = json_settings["ignored_keywords"] ignore_type = json_settings["ignore_type"] - blacklist_name = json_settings["blacklist_name"] + blacklists = json_settings["blacklists"] webhook = json_settings["webhook"] text_length = json_settings["text_length"] @@ -1261,26 +1261,26 @@ async def manage_subscriptions( authed: create_auth, auth_count=0, identifiers: list = [], refresh: bool = True ): results = await authed.get_subscriptions(identifiers=identifiers, refresh=refresh) - if blacklist_name: + if blacklists: response = await authed.get_lists() - if not response: - return [False, []] - new_results = [c for c in response if blacklist_name == c["name"]] - if new_results: - item = new_results[0] - list_users = item["users"] - if int(item["usersCount"]) > 2: - list_id = str(item["id"]) - list_users = await authed.get_lists_users(list_id) - if list_users: - users = list_users - bl_ids = [x["username"] for x in users] - results2 = results.copy() - for result in results2: - identifier = result.username - if identifier in bl_ids: - print("Blacklisted: " + identifier) - results.remove(result) + if response: + for blacklist in blacklists: + new_results = [c for c in response if response and blacklist == c["name"]] + if new_results: + item = new_results[0] + list_users = item["users"] + if int(item["usersCount"]) > 2: + list_id = str(item["id"]) + list_users = await authed.get_lists_users(list_id) + if list_users: + users = list_users + bl_ids = [x["username"] for x in users] + results2 = results.copy() + for result in results2: + identifier = result.username + if identifier in bl_ids: + print("Blacklisted: " + identifier) + results.remove(result) results.sort(key=lambda x: x.subscribedByData["expiredAt"]) results.sort(key=lambda x: x.is_me(), reverse=True) results2 = []