diff --git a/docs/configuration.rst b/docs/configuration.rst index 8c7f3712..5f8ac6eb 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1475,6 +1475,22 @@ Description * ``"exhentai.org"``: Use ``exhentai.org`` for all URLs +extractor.exhentai.fav +---------------------- +Type + ``string`` +Example + ``"4"`` +Description + After downloading a gallery, + add it to your account's favorites as the given category number. + + Note: Set this to `"favdel"` to remove galleries from your favorites. + + Note: This will remove any Favorite Notes when applied + to already favorited galleries. + + extractor.exhentai.limits ------------------------- Type diff --git a/gallery_dl/extractor/exhentai.py b/gallery_dl/extractor/exhentai.py index 5ee008d1..0a60ed82 100644 --- a/gallery_dl/extractor/exhentai.py +++ b/gallery_dl/extractor/exhentai.py @@ -179,6 +179,20 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor): if source == "hitomi": self.items = self._items_hitomi + def favorite(self, slot="0"): + url = self.root + "/gallerypopups.php" + params = { + "gid": self.gallery_id, + "t" : self.gallery_token, + "act": "addfav", + } + data = { + "favcat" : slot, + "apply" : "Apply Changes", + "update" : "1", + } + self.request(url, method="POST", params=params, data=data) + def items(self): self.login() @@ -223,6 +237,10 @@ class ExhentaiGalleryExtractor(ExhentaiExtractor): data["_http_validate"] = None yield Message.Url, url, data + fav = self.config("fav") + if fav is not None: + self.favorite(fav) + def _items_hitomi(self): if self.config("metadata", False): data = self.metadata_from_api()