From f367ff42808635b9036d17ded04ebbadc0793ba9 Mon Sep 17 00:00:00 2001 From: CRIMINAL Date: Sun, 29 Dec 2019 03:15:32 +0000 Subject: [PATCH] Feature [OnlyFans] config: "ignore_unfollowed_accounts" You can now filter unfollowed accounts from the subscription list. --- README.md | 15 ++++++++++++++- config.json | 3 ++- modules/helpers.py | 5 +++-- modules/onlyfans.py | 15 ++++++++++++++- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 92a22cdf1..a5b2266a9 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ auto_choice: You can automatically choose what you want to scrape if you add it in the config file. -|**NEW**| auto_scrape_all: +auto_scrape_all: Default = false @@ -154,6 +154,19 @@ ignored_keywords: Any words you input, the script will ignore any content that contains these words. +|**NEW**| ignore_unfollowed_accounts: + + Default = "" + a = "all" + b = "paid" + c = "free" + + This setting will not include any paid or free accounts that you've unfollowed in your subscription list. + + "ignore_unfollowed_accounts": "paid" + + This choice will not include any unfollowed accounts that you've paid for. + # OPTIONAL ARGUMENTS diff --git a/config.json b/config.json index 852a0a5b0..11520561f 100644 --- a/config.json +++ b/config.json @@ -22,7 +22,8 @@ "text_length": "", "overwrite_files": true, "date_format": "%d-%m-%Y", - "ignored_keywords": [] + "ignored_keywords": [], + "ignore_unfollowed_accounts": "" } }, "justforfans": { diff --git a/modules/helpers.py b/modules/helpers.py index 33af87c03..1220d55b1 100644 --- a/modules/helpers.py +++ b/modules/helpers.py @@ -68,7 +68,7 @@ def reformat(directory, file_name, text, ext, date, username, format_path, date_ directory2 = directory filename = os.path.basename(directory2) if len(filename) > 240: - directory2 = directory2.replace(filename,filename[:240]+"."+ext) + directory2 = directory2.replace(filename, filename[:240]+"."+ext) return directory2 @@ -132,7 +132,8 @@ def format_directory(j_directory, site_name, username, location, api_type): os.path.realpath(__file__))) + user_directory metadata_directory = os.path.dirname(os.path.dirname( os.path.realpath(__file__))) + metadata_directory - directories.append([location,user_directory+api_type + "/" + location+"/"]) + directories.append( + [location, user_directory+api_type + "/" + location+"/"]) else: directories.append( [location, user_directory+api_type + "/" + location+"/"]) diff --git a/modules/onlyfans.py b/modules/onlyfans.py index 4d1de4eed..4d2dc6ef6 100644 --- a/modules/onlyfans.py +++ b/modules/onlyfans.py @@ -26,6 +26,7 @@ overwrite_files = json_settings["overwrite_files"] date_format = json_settings["date_format"] ignored_keywords = json_settings["ignored_keywords"] +ignore_unfollowed_accounts = json_settings["ignore_unfollowed_accounts"] maximum_length = 240 text_length = int(json_settings["text_length"] ) if json_settings["text_length"] else maximum_length @@ -408,11 +409,23 @@ def multi(link, session): else: results2 = [] for result in results: + username = result["username"] now = datetime.utcnow() - result_date = result["subscribedByData"]["expiredAt"] + subscribedBy = result["subscribedBy"] + subscribedByData = result["subscribedByData"] + result_date = subscribedByData["expiredAt"] + price = subscribedByData["price"] + subscribePrice = subscribedByData["subscribePrice"] result_date = datetime.fromisoformat( result_date).replace(tzinfo=None) if result_date > now: + if not subscribedBy: + if ignore_unfollowed_accounts in ["all", "paid"]: + if price > 0: + continue + if ignore_unfollowed_accounts in ["all", "free"]: + if subscribePrice == 0: + continue results2.append(result) return results2