From d11e2191ae6698425c277f22a4db91b6a862e140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 1 May 2022 17:45:38 +0200 Subject: [PATCH] [nijie] support /history_nuita.php listings (closes #2541) --- docs/configuration.rst | 4 +-- docs/supportedsites.md | 2 +- gallery_dl/extractor/nijie.py | 48 ++++++++++++++++++++++++++++++----- scripts/supportedsites.py | 3 +++ 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 16e7192e..11b15fc1 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1648,7 +1648,7 @@ Description extractor.nijie.include ----------------------------- +----------------------- Type ``string`` or ``list`` of ``strings`` Default @@ -1658,7 +1658,7 @@ Description when processing a user profile. Possible values are - ``"illustration"``, ``"doujin"``, ``"favorite"``. + ``"illustration"``, ``"doujin"``, ``"favorite"``, ``"nuita"``. You can use ``"all"`` instead of listing all values separately. diff --git a/docs/supportedsites.md b/docs/supportedsites.md index 880744cb..089eb8c2 100644 --- a/docs/supportedsites.md +++ b/docs/supportedsites.md @@ -538,7 +538,7 @@ Consider all sites to be NSFW unless otherwise known. nijie https://nijie.info/ - Doujin, Favorites, Illustrations, individual Images, User Profiles + Doujin, Favorites, Illustrations, individual Images, Nuita History, User Profiles Required diff --git a/gallery_dl/extractor/nijie.py b/gallery_dl/extractor/nijie.py index 90ca01da..832831ff 100644 --- a/gallery_dl/extractor/nijie.py +++ b/gallery_dl/extractor/nijie.py @@ -91,6 +91,10 @@ class NijieExtractor(AsynchronousMixin, Extractor): "url": url, }) + @staticmethod + def _extract_user_name(page): + return text.unescape(text.extract(page, "
", "<")[0] or "") + def login(self): """Login and obtain session cookies""" if not self._check_cookies(self.cookienames): @@ -119,9 +123,8 @@ class NijieExtractor(AsynchronousMixin, Extractor): while True: page = self.request(url, params=params, notfound="artist").text - if not self.user_name: - self.user_name = text.unescape(text.extract( - page, '
', '<')[0] or "") + if self.user_name is None: + self.user_name = self._extract_user_name(page) yield from text.extract_iter(page, 'illust_id="', '"') if '