def assign_vars(json_auth, config, site_settings, site_name): global json_config, multithreading, proxies, cert, json_settings, auto_choice, j_directory, overwrite_files, date_format, file_directory_format, file_name_format, ignored_keywords, ignore_type, export_metadata, delete_legacy_metadata, sort_free_paid_posts, blacklist_name, webhook, maximum_length, app_token json_config = config json_global_settings = json_config["settings"] multithreading = json_global_settings["multithreading"] proxies = json_global_settings["socks5_proxy"] cert = json_global_settings["cert"] json_settings = site_settings auto_choice = json_settings["auto_choice"] j_directory = main_helper.get_directory( json_settings['download_paths'], site_name) file_directory_format = json_settings["file_directory_format"] file_name_format = json_settings["file_name_format"] overwrite_files = json_settings["overwrite_files"] date_format = json_settings["date_format"] ignored_keywords = json_settings["ignored_keywords"] ignore_type = json_settings["ignore_type"] export_metadata = json_settings["export_metadata"] delete_legacy_metadata = json_settings["delete_legacy_metadata"] sort_free_paid_posts = json_settings["sort_free_paid_posts"] blacklist_name = json_settings["blacklist_name"] webhook = json_settings["webhook"] maximum_length = 255 maximum_length = int(json_settings["text_length"] ) if json_settings["text_length"] else maximum_length app_token = json_auth['app_token']
def assign_vars(json_auth, config, site_settings, site_name): global json_config, json_global_settings, max_threads, json_settings, auto_choice, j_directory, metadata_directory_format, overwrite_files, date_format, file_directory_format, file_name_format, ignored_keywords, ignore_type, export_metadata, delete_legacy_metadata, blacklist_name, webhook, maximum_length, app_token json_config = config json_global_settings = json_config["settings"] max_threads = json_global_settings["max_threads"] json_settings = site_settings auto_choice = json_settings["auto_choice"] j_directory = main_helper.get_directory( json_settings['download_directories'], site_name) metadata_directory_format = json_settings["metadata_directory_format"] file_directory_format = json_settings["file_directory_format"] file_name_format = json_settings["file_name_format"] overwrite_files = json_settings["overwrite_files"] date_format = json_settings["date_format"] ignored_keywords = json_settings["ignored_keywords"] ignore_type = json_settings["ignore_type"] export_metadata = json_settings["export_metadata"] delete_legacy_metadata = json_settings["delete_legacy_metadata"] blacklist_name = json_settings["blacklist_name"] webhook = json_settings["webhook"] maximum_length = 255 maximum_length = int(json_settings["text_length"] ) if json_settings["text_length"] else maximum_length app_token = json_auth['app_token']
def assign_vars(config, site_settings, site_name): global json_config, multithreading, json_settings, auto_choice, j_directory, overwrite_files, date_format, file_directory_format,file_name_format, boards, ignored_keywords, webhook, maximum_length json_config = config json_global_settings = json_config["settings"] multithreading = json_global_settings["multithreading"] json_settings = site_settings auto_choice = json_settings["auto_choice"] j_directory = main_helper.get_directory(json_settings['download_paths'], site_name) file_directory_format = json_settings["file_directory_format"] file_name_format = json_settings["file_name_format"] overwrite_files = json_settings["overwrite_files"] date_format = json_settings["date_format"] boards = json_settings["boards"] ignored_keywords = json_settings["ignored_keywords"] webhook = json_settings["webhook"] maximum_length = 255 maximum_length = int(json_settings["text_length"] ) if json_settings["text_length"] else maximum_length
def assign_vars(config, site_settings): global json_config, multithreading, proxy, json_settings, auto_choice, j_directory, overwrite_files, date_format, format_path, ignored_keywords, ignore_unfollowed_accounts, export_metadata, blacklist_name, maximum_length json_config = config json_global_settings = json_config["settings"] multithreading = json_global_settings["multithreading"] proxy = json_global_settings["socks5_proxy"] json_settings = site_settings auto_choice = json_settings["auto_choice"] j_directory = get_directory(json_settings['directory']) format_path = json_settings["file_name_format"] 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"] export_metadata = json_settings["export_metadata"] blacklist_name = json_settings["blacklist_name"] maximum_length = 255 maximum_length = int(json_settings["text_length"] ) if json_settings["text_length"] else maximum_length
def assign_vars(json_auth: auth_details, config, site_settings, site_name): global json_config, json_global_settings, max_threads, json_settings, auto_choice, j_directory, metadata_directory_format, overwrite_files, date_format, file_directory_format, filename_format, ignored_keywords, ignore_type, blacklist_name, webhook, text_length, app_token json_config = config json_global_settings = json_config["settings"] max_threads = json_global_settings["max_threads"] json_settings = site_settings auto_choice = json_settings["auto_choice"] j_directory = main_helper.get_directory( json_settings['download_directories'], site_name) metadata_directory_format = json_settings["metadata_directory_format"] file_directory_format = json_settings["file_directory_format"] filename_format = json_settings["filename_format"] overwrite_files = json_settings["overwrite_files"] date_format = json_settings["date_format"] ignored_keywords = json_settings["ignored_keywords"] ignore_type = json_settings["ignore_type"] blacklist_name = json_settings["blacklist_name"] webhook = json_settings["webhook"] text_length = json_settings["text_length"] app_token = json_auth.app_token
def assign_vars(config, site_settings, site_name): global json_config, multithreading, proxy, json_settings, auto_choice, j_directory, overwrite_files, date_format, format_path, ignored_keywords, ignore_type, export_metadata, delete_legacy_metadata, sort_free_paid_posts, blacklist_name, maximum_length json_config = config json_global_settings = json_config["settings"] multithreading = json_global_settings["multithreading"] proxy = json_global_settings["socks5_proxy"] json_settings = site_settings auto_choice = json_settings["auto_choice"] j_directory = get_directory(json_settings['download_path'], site_name) format_path = json_settings["file_name_format"] overwrite_files = json_settings["overwrite_files"] date_format = json_settings["date_format"] ignored_keywords = json_settings["ignored_keywords"] ignore_type = json_settings["ignore_type"] export_metadata = json_settings["export_metadata"] delete_legacy_metadata = json_settings["delete_legacy_metadata"] sort_free_paid_posts = json_settings["sort_free_paid_posts"] blacklist_name = json_settings["blacklist_name"] maximum_length = 255 maximum_length = int(json_settings["text_length"] ) if json_settings["text_length"] else maximum_length
import math from urllib.parse import urlparse from itertools import groupby import extras.OFSorter.ofsorter as ofsorter import shutil log_download = setup_logger('downloads', 'downloads.log') # Open config.json and fill in OPTIONAL information path = os.path.join('.settings', 'config.json') json_config = json.load(open(path)) json_global_settings = json_config["settings"] multithreading = json_global_settings["multithreading"] json_settings = json_config["supported"]["onlyfans"]["settings"] auto_choice = json_settings["auto_choice"] j_directory = get_directory(json_settings['directory']) format_path = json_settings['file_name_format'] overwrite_files = json_settings["overwrite_files"] proxy = json_global_settings["socks5_proxy"] date_format = json_settings["date_format"] ignored_keywords = json_settings["ignored_keywords"] ignore_unfollowed_accounts = json_settings["ignore_unfollowed_accounts"] export_metadata = json_settings["export_metadata"] delete_legacy_metadata = json_settings["delete_legacy_metadata"] sort_free_paid_posts = json_settings["sort_free_paid_posts"] blacklist_name = json_settings["blacklist_name"] maximum_length = 255 maximum_length = int(json_settings["text_length"] ) if json_settings["text_length"] else maximum_length
string += " | " print(string) match = ["All", "OnlyFans", "Patreon", "StarsAVN", "4Chan", "BBWChan"] choices = list(zip(choices, match)) x = 1 x = int(input()) if x == 0: del choices[0] else: choices = [choices[x]] for choice in choices: name = choice[1] choice = choice[0] json_settings = json_config[choice]["settings"] download_paths = json_settings["download_paths"] directory = main_helper.get_directory(download_paths, name) content_folders = os.listdir(directory) # content_folders = ["queenarri"] models_folders2 = [] if name in ["4Chan", "BBWChan"]: for models_folder in content_folders: directory2 = os.path.join(directory, models_folder) content_list = os.listdir(directory2) for content in content_list: content = os.path.join(directory2, content) x = main_helper.metadata_fixer(content) models_folders2.append(content) continue else: for models_folder in content_folders: directory2 = os.path.join(directory, models_folder)
def fix_metadata(posts, json_settings, username, site_name): for post in posts: for model in post: model_folder = model.directory if model.links: path = urlparse.urlparse(model.links[0]).path else: path = model.filename filename = os.path.basename(path) filepath = os.path.join(model_folder, filename) post_id = str(model.post_id) filename, ext = os.path.splitext(filename) ext = ext.replace(".", "") format_path = json_settings["file_name_format"] date_format = json_settings["date_format"] text_length = json_settings["text_length"] download_path = json_settings["download_path"] today = datetime.today() today = today.strftime("%d-%m-%Y %H:%M:%S") class prepare_reformat(object): def __init__(self, option): self.directory = option.get( 'directory') self.post_id = option.get('post_id', "") self.media_id = option.get('media_id', "") self.filename = filename self.text = main_helper.clean_text(option.get('text', "")) self.ext = option.get('ext', ext) self.date = option.get('postedAt', today) self.username = option.get('username', username) self.format_path = format_path self.date_format = date_format self.maximum_length = int(text_length) model2 = json.loads(json.dumps( model, default=lambda o: o.__dict__)) reformat = prepare_reformat(model2) def update(filepath): temp = json.loads(json.dumps( reformat, default=lambda o: o.__dict__)) filepath = os.path.abspath(filepath) new_format = main_helper.reformat(**temp) new_format = os.path.abspath(new_format) if filepath != new_format: if not os.path.isfile(new_format): shutil.move(filepath, new_format) return new_format if os.path.isfile(filepath): filepath = update(filepath) else: folder = os.path.dirname(filepath) folder = os.path.abspath(folder) while not os.path.exists(folder): print("NOT FOUND: "+folder) last_path = folder.split(username+"\\")[1] directory = main_helper.get_directory( download_path, site_name) folder = os.path.join(directory, username, last_path) reformat.directory = folder print("FOUND: "+folder) files = os.listdir(folder) y = [file_ for file_ in files if filename in file_] if y: y = y[0] filepath = os.path.join(folder, y) filepath = update(filepath) model.filename = os.path.basename(filepath) return posts