1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[exhentai] add 'fav' option (#4409)

The name 'favorite' is already taken as extractor subcategory
This commit is contained in:
Mike Fährmann 2023-08-23 12:54:45 +02:00
parent fd6b413f3c
commit 5ed245317d
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 34 additions and 0 deletions

View File

@ -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

View File

@ -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()