From 38c6bef6e97cc0f0b682df1ba3938a1dfc731c54 Mon Sep 17 00:00:00 2001 From: franchioping Date: Mon, 22 Jul 2024 22:05:38 +0100 Subject: [PATCH] basic mangadex integration (untested) --- .idea/.gitignore | 8 ++++++ .idea/MangaBot.iml | 10 +++++++ .idea/inspectionProfiles/Project_Default.xml | 23 +++++++++++++++ .../inspectionProfiles/profiles_settings.xml | 6 ++++ .idea/misc.xml | 7 +++++ .idea/modules.xml | 8 ++++++ .idea/vcs.xml | 6 ++++ main.py | 1 + manga.py | 28 +++++++++++++++++++ 9 files changed, 97 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/MangaBot.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 main.py create mode 100644 manga.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/MangaBot.iml b/.idea/MangaBot.iml new file mode 100644 index 0000000..33eee00 --- /dev/null +++ b/.idea/MangaBot.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..5885cde --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8878924 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5132b55 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..6a12326 --- /dev/null +++ b/main.py @@ -0,0 +1 @@ +sada \ No newline at end of file diff --git a/manga.py b/manga.py new file mode 100644 index 0000000..4e4e699 --- /dev/null +++ b/manga.py @@ -0,0 +1,28 @@ +import mangadex as md +import os +from dotenv import load_dotenv + +load_dotenv() + + +class MangaWrapper: + def __init__(self): + self.auth = md.auth.Auth() + self.auth.login(os.environ.get("MANGADEX_USR"), + os.environ.get("MANGADEX_PSWD"), + os.environ.get("MANGADEX_CLIENT"), + os.environ.get("MANGADEX_TOKEN") + ) + self.manga = md.series.Manga(auth=self.auth) + self.chapter = md.series.Chapter(auth=self.auth) + + def search(self, title: str, limit: int = 10) -> list[md.series.Manga]: + return self.manga.get_manga_list(title=title) + + def get_chapters(self, manga: md.series.Manga): + return self.chapter.get_manga_volumes_and_chapters(manga_id=manga.manga_id) + + +if __name__ == "__main__": + mw = MangaWrapper() + print(mw.search("I Turned off the Pain Perception Setting!")[0])