Skip to content

Commit

Permalink
create_session change
Browse files Browse the repository at this point in the history
Script will now use one socks5 connection. This is mainly to do on my end with my custom script.

OFRenamer isn't finished yet. Don't run it.
  • Loading branch information
SecretShell committed Jun 1, 2020
1 parent 440596d commit 6a49a3e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
3 changes: 2 additions & 1 deletion datascraper/main_datascraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def start_datascraper():
'user_agent'] else json_auth['user_agent']

x = onlyfans
session = x.create_session(
session = x.create_session()
session = x.create_auth(session,
user_agent, app_token, json_auth)
session_array.append(session)
if not session["session"]:
Expand Down
22 changes: 22 additions & 0 deletions extras/OFRenamer/start.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
import json
# WORK IN PROGRESS
directory = ""

models = os.listdir(directory)
print(models)
for model in models:
metadata_directory = os.path.join(directory, model, "Metadata")
folders = os.listdir(metadata_directory)
for metadata_file in folders:
metadata_filepath = os.path.join(metadata_directory, metadata_file)
metadatas = json.load(open(metadata_filepath))[0]["valid"]
for metadata in metadatas:
for folder in metadata:
model_folder = folder["directory"]
filename = folder["filename"]
filepath = os.path.join(model_folder, filename)
if os.path.isfile(filepath):
print
else:
print
23 changes: 15 additions & 8 deletions modules/onlyfans.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,21 @@ def choose_link(session, links):
media_set, [session], [directory], [username]))


def create_session(user_agent, app_token, auth_array):
def create_session():
max_threads = multiprocessing.cpu_count()
session = requests.Session()
proxies = {'http': 'socks5://'+proxy,
'https': 'socks5://'+proxy}
if proxy:
session.proxies = proxies
session.mount(
'https://', requests.adapters.HTTPAdapter(pool_connections=max_threads, pool_maxsize=max_threads))
ip = session.get('https://checkip.amazonaws.com').text.strip()
print("Session IP: "+ip)
return session


def create_auth(session, user_agent, app_token, auth_array):
me_api = []
auth_count = 1
auth_version = "(V1)"
Expand All @@ -617,13 +631,6 @@ def create_session(user_agent, app_token, auth_array):
del auth_cookies[2]
count = 1
print("Auth "+auth_version)
session = requests.Session()
proxies = {'http': 'socks5://'+proxy,
'https': 'socks5://'+proxy}
if proxy:
session.proxies = proxies
session.mount(
'https://', requests.adapters.HTTPAdapter(pool_connections=max_threads, pool_maxsize=max_threads))
session.headers = {
'User-Agent': user_agent, 'Referer': 'https://onlyfans.com/'}
if auth_array["sess"]:
Expand Down

0 comments on commit 6a49a3e

Please sign in to comment.