Skip to content

Commit

Permalink
Feature
Browse files Browse the repository at this point in the history
[OnlyFans]

config:
"ignore_unfollowed_accounts"
You can now filter unfollowed accounts from the subscription list.
  • Loading branch information
SecretShell committed Dec 29, 2019
1 parent df852fd commit f367ff4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"text_length": "",
"overwrite_files": true,
"date_format": "%d-%m-%Y",
"ignored_keywords": []
"ignored_keywords": [],
"ignore_unfollowed_accounts": ""
}
},
"justforfans": {
Expand Down
5 changes: 3 additions & 2 deletions modules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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+"/"])
Expand Down
15 changes: 14 additions & 1 deletion modules/onlyfans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit f367ff4

Please sign in to comment.