From bc6757b90036931adad93ac4c24dd23deccd506d Mon Sep 17 00:00:00 2001 From: msglm Date: Fri, 3 May 2024 10:31:37 -0500 Subject: tiktok uses yt-dlp; make sure to source the local gallery-dl config --- stashley/stashley.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/stashley/stashley.py b/stashley/stashley.py index e678e79..b544464 100644 --- a/stashley/stashley.py +++ b/stashley/stashley.py @@ -1,12 +1,13 @@ - import tomli - +#import tomli_w import argparse import yt_dlp import gallery_dl import os +from sherlock import sherlock from datetime import datetime +gallery_dl.config.load() gallery_dl.config.set(('extractor',),"base-directory", './') parser = argparse.ArgumentParser( @@ -14,11 +15,19 @@ parser = argparse.ArgumentParser( description='a program used for archiving personalities using TOML files' ) parser.add_argument('filename', type=str, nargs='?', help="Toml file to process") - +parser.add_argument('--initialize' ,'-i', dest='initialize', action='store_true', help='Given a file, initalize it using sherlock.') args = parser.parse_args() input = tomli.load(open(args.filename, 'rb')) +if args.initialize: + input["aliases"] + for alias in input["aliases"]: + sites = sherlock.SitesInformation() + site_data = {site.name: site.information for site in sites} + print(sherlock.sherlock(alias, site_data, sherlock.QueryNotifyPrint()).pretty()) + exit(0) + def legalfy(url: str) -> str: return ''.join(letter for letter in url if letter.isalnum()) @@ -43,6 +52,8 @@ def figureUse(lore: dict, keyname: str) -> str: match keyname.lower(): case "youtube": return "ytdl" + case "tiktok": + return "ytdl" case "website": return "website" case "site": @@ -71,7 +82,12 @@ def videohost(sitename: str, urls: list[str]): def gallery(urls: list[str]): for url in urls: - gallery_dl.job.DownloadJob(url).run() + try: + print("Attempting to download " + url) + gallery_dl.job.DownloadJob(url).run() + except: + print("Could not download " + url) + continue def archivesite(urls: list[str]): os.makedirs('websites', exist_ok=True) -- cgit v1.2.3