diff options
author | msglm <msglm@techchud.xyz> | 2024-05-03 10:31:37 -0500 |
---|---|---|
committer | msglm <msglm@techchud.xyz> | 2024-05-03 10:31:37 -0500 |
commit | bc6757b90036931adad93ac4c24dd23deccd506d (patch) | |
tree | 7c6e29b4893ca4156c88bcfad0185eee0b7d0aeb | |
parent | bc99d6cf1935213e2f8c72472a176a8fbef5ffd3 (diff) | |
download | stashley-bc6757b90036931adad93ac4c24dd23deccd506d.tar.gz stashley-bc6757b90036931adad93ac4c24dd23deccd506d.tar.bz2 stashley-bc6757b90036931adad93ac4c24dd23deccd506d.zip |
tiktok uses yt-dlp; make sure to source the local gallery-dl configv2.0.1
-rw-r--r-- | stashley/stashley.py | 24 |
1 files 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) |