From ba4421aed44905f77382d8768bf03050e227fa76 Mon Sep 17 00:00:00 2001 From: CRIMINAL Date: Tue, 28 Jan 2020 04:02:09 +0000 Subject: [PATCH] OnlyFans Checking if sess token valid Checking if head request is valid --- modules/helpers.py | 4 ++++ modules/onlyfans.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/helpers.py b/modules/helpers.py index e4ab31058..66cc256a6 100644 --- a/modules/helpers.py +++ b/modules/helpers.py @@ -201,3 +201,7 @@ def json_request(session, link, type="GET"): return r except ConnectionResetError: count += 1 + +def update_config(json_config): + with open('config.json', 'w', encoding='utf-8') as f: + json.dump(json_config, f, ensure_ascii=False, indent=2) diff --git a/modules/onlyfans.py b/modules/onlyfans.py index 7780881bd..67cce0dcb 100644 --- a/modules/onlyfans.py +++ b/modules/onlyfans.py @@ -315,7 +315,9 @@ def download_media(media_set, session, directory, username, post_count, location def download(media, session, directory, username): while True: link = media["link"] - r = session.head(link) + r = json_request(session, link, "HEAD") + if not r: + break header = r.headers content_length = int(header["content-length"])