From 85cfd4bd4d0cb6650310b331bb276bdf4c08b834 Mon Sep 17 00:00:00 2001 From: Ashley Graves Date: Mon, 30 Sep 2024 06:31:28 +0000 Subject: [PATCH] make tags easier to change --- example.env | 3 +++ post.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/example.env b/example.env index 8e03311..6ec9b59 100644 --- a/example.env +++ b/example.env @@ -2,3 +2,6 @@ GELBOORU_API_UID=42069 GELBOORU_API_KEY=api-key PLEROMA_INSTANCE=https://incest.world PLEROMA_ACCESS_TOKEN=access-token + +TAGS_INCLUDE=yuri +TAGS_EXCLUDE=ai_generated,1boy diff --git a/post.py b/post.py index b7721e2..bab732e 100644 --- a/post.py +++ b/post.py @@ -7,11 +7,16 @@ from urllib.request import Request, urlopen config = dotenv_values(".env") gelbooru = Gelbooru(config["GELBOORU_API_KEY"], config["GELBOORU_API_UID"]) +include_tags = config["TAGS_INCLUDE"].split(",") +exclude_tags = config["TAGS_EXCLUDE"].split(",") + +preset_tags=["sort:random", "rating:s"] + async def main(): masto = Mastodon(api_base_url = config["PLEROMA_INSTANCE"], access_token = config["PLEROMA_ACCESS_TOKEN"], feature_set = "pleroma") try: - posts = await gelbooru.search_posts(tags=["sort:random", "rating:s", "yuri", "sisters"], exclude_tags=["ai_generated", "1boy"]) + posts = await gelbooru.search_posts(tags=preset_tags + include_tags, exclude_tags=exclude_tags) result = posts[0] req = Request(url=result.file_url, headers={"User-Agent": "Mozilla/5.0"})