diff --git a/.env b/.env index 3a10ed0..ea2436a 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ -baseurl=https://yourinstance.com/api -secret=bot secret from get_apps.py here -api_key=apikey generated from the misskey ui +baseurl=https://eepykitty.lol/api +secret=u17dsYbrNtByjNHs4M6YE9kqNERF2Ppm +api_key=GiUvYKqXWw1WNXVcIVmBCwwwCiSzAmbj searchquery=yaoi rating:general order:random bannedtags=["meme", "nazi", "military", "war","nsfw","sex","penis","pussy"] -danbooru_user=username of the bots danbooru account -danbooru_apikey=api key for danbooru \ No newline at end of file +danbooru_user=Yaoibot +danbooru_apikey=VKiPjDiknJZB57yNHzFvEYXX \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/__pycache__/image_source.cpython-312.pyc b/__pycache__/image_source.cpython-312.pyc new file mode 100644 index 0000000..c788231 Binary files /dev/null and b/__pycache__/image_source.cpython-312.pyc differ diff --git a/image_source.py b/image_source.py index 258d653..68fba59 100644 --- a/image_source.py +++ b/image_source.py @@ -54,6 +54,8 @@ def get_image_url(post): else: print("Image URL not found in the post data.") return None + + def get_artist_names(post): return post['tag_string_artist'].split(',') if 'tag_string_artist' in post else [] @@ -62,6 +64,7 @@ def main(): random_post = fetch_random_post() if random_post: print(f"URL: https://danbooru.donmai.us/posts/{random_post['id']}") + print(random_post["tag_string_character"]) image_url = get_image_url(random_post) # if image_url: # r = requests.get(image_url) @@ -78,7 +81,7 @@ def main(): else: artists = "Unknown" - return f"https://danbooru.donmai.us/posts/{random_post['id']}", image_url, artists + return f"https://danbooru.donmai.us/posts/{random_post['id']}", image_url, artists, random_post["tag_string_character"] if __name__ == "__main__": main() diff --git a/main.py b/main.py index cce74dd..6f6c9a2 100644 --- a/main.py +++ b/main.py @@ -33,13 +33,14 @@ def post(text,id): -def upload_url(fileurl): +def upload_url(fileurl,comment): path = "/drive/files/upload-from-url" url = baseurl+path data = { "url": fileurl, - "appSecret": os.getenv("secret") + "appSecret": os.getenv("secret"), + "comment":comment } @@ -77,9 +78,9 @@ def get_id(filename): return get_id(filename) def main(): - posturl, url, artists = image_source.main() + posturl, url, artists, characters = image_source.main() filename = url.split("/")[len(url.split("/"))-1] - upload_url(url) + upload_url(url, f"SFW yaoi art of the following characters : {characters}") post(f"Artist(s): {artists}\nSource: {posturl}",get_id(filename))