[nijie] support /history_nuita.php listings (closes #2541)
This commit is contained in:
@@ -1648,7 +1648,7 @@ Description
|
|||||||
|
|
||||||
|
|
||||||
extractor.nijie.include
|
extractor.nijie.include
|
||||||
----------------------------
|
-----------------------
|
||||||
Type
|
Type
|
||||||
``string`` or ``list`` of ``strings``
|
``string`` or ``list`` of ``strings``
|
||||||
Default
|
Default
|
||||||
@@ -1658,7 +1658,7 @@ Description
|
|||||||
when processing a user profile.
|
when processing a user profile.
|
||||||
|
|
||||||
Possible values are
|
Possible values are
|
||||||
``"illustration"``, ``"doujin"``, ``"favorite"``.
|
``"illustration"``, ``"doujin"``, ``"favorite"``, ``"nuita"``.
|
||||||
|
|
||||||
You can use ``"all"`` instead of listing all values separately.
|
You can use ``"all"`` instead of listing all values separately.
|
||||||
|
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ Consider all sites to be NSFW unless otherwise known.
|
|||||||
<tr>
|
<tr>
|
||||||
<td>nijie</td>
|
<td>nijie</td>
|
||||||
<td>https://nijie.info/</td>
|
<td>https://nijie.info/</td>
|
||||||
<td>Doujin, Favorites, Illustrations, individual Images, User Profiles</td>
|
<td>Doujin, Favorites, Illustrations, individual Images, Nuita History, User Profiles</td>
|
||||||
<td>Required</td>
|
<td>Required</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -91,6 +91,10 @@ class NijieExtractor(AsynchronousMixin, Extractor):
|
|||||||
"url": url,
|
"url": url,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _extract_user_name(page):
|
||||||
|
return text.unescape(text.extract(page, "<br />", "<")[0] or "")
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
"""Login and obtain session cookies"""
|
"""Login and obtain session cookies"""
|
||||||
if not self._check_cookies(self.cookienames):
|
if not self._check_cookies(self.cookienames):
|
||||||
@@ -119,9 +123,8 @@ class NijieExtractor(AsynchronousMixin, Extractor):
|
|||||||
while True:
|
while True:
|
||||||
page = self.request(url, params=params, notfound="artist").text
|
page = self.request(url, params=params, notfound="artist").text
|
||||||
|
|
||||||
if not self.user_name:
|
if self.user_name is None:
|
||||||
self.user_name = text.unescape(text.extract(
|
self.user_name = self._extract_user_name(page)
|
||||||
page, '<br />', '<')[0] or "")
|
|
||||||
yield from text.extract_iter(page, 'illust_id="', '"')
|
yield from text.extract_iter(page, 'illust_id="', '"')
|
||||||
|
|
||||||
if '<a rel="next"' not in page:
|
if '<a rel="next"' not in page:
|
||||||
@@ -137,11 +140,12 @@ class NijieUserExtractor(NijieExtractor):
|
|||||||
test = ("https://nijie.info/members.php?id=44",)
|
test = ("https://nijie.info/members.php?id=44",)
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
base = "{}/{{}}.php?id={}".format(self.root, self.user_id)
|
fmt = "{}/{{}}.php?id={}".format(self.root, self.user_id).format
|
||||||
return self._dispatch_extractors((
|
return self._dispatch_extractors((
|
||||||
(NijieIllustrationExtractor, base.format("members_illust")),
|
(NijieIllustrationExtractor, fmt("members_illust")),
|
||||||
(NijieDoujinExtractor , base.format("members_dojin")),
|
(NijieDoujinExtractor , fmt("members_dojin")),
|
||||||
(NijieFavoriteExtractor , base.format("user_like_illust_view")),
|
(NijieFavoriteExtractor , fmt("user_like_illust_view")),
|
||||||
|
(NijieNuitaExtractor , fmt("history_nuita")),
|
||||||
), ("illustration", "doujin"))
|
), ("illustration", "doujin"))
|
||||||
|
|
||||||
|
|
||||||
@@ -217,6 +221,36 @@ class NijieFavoriteExtractor(NijieExtractor):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
class NijieNuitaExtractor(NijieExtractor):
|
||||||
|
"""Extractor for a nijie user's 抜いた list"""
|
||||||
|
subcategory = "nuita"
|
||||||
|
directory_fmt = ("{category}", "nuita", "{user_id}")
|
||||||
|
archive_fmt = "n_{user_id}_{image_id}_{num}"
|
||||||
|
pattern = BASE_PATTERN + r"/history_nuita\.php\?id=(\d+)"
|
||||||
|
test = ("https://nijie.info/history_nuita.php?id=728995", {
|
||||||
|
"range": "1-10",
|
||||||
|
"count": 10,
|
||||||
|
"keyword": {
|
||||||
|
"user_id" : 728995,
|
||||||
|
"user_name": "莚",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
def image_ids(self):
|
||||||
|
return self._pagination("history_nuita")
|
||||||
|
|
||||||
|
def _extract_data(self, page):
|
||||||
|
data = NijieExtractor._extract_data(page)
|
||||||
|
data["user_id"] = self.user_id
|
||||||
|
data["user_name"] = self.user_name
|
||||||
|
return data
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _extract_user_name(page):
|
||||||
|
return text.unescape(text.extract(
|
||||||
|
page, "<title>", "さんの抜いた")[0] or "")
|
||||||
|
|
||||||
|
|
||||||
class NijieImageExtractor(NijieExtractor):
|
class NijieImageExtractor(NijieExtractor):
|
||||||
"""Extractor for a work/image from nijie.info"""
|
"""Extractor for a work/image from nijie.info"""
|
||||||
subcategory = "image"
|
subcategory = "image"
|
||||||
|
|||||||
@@ -183,6 +183,9 @@ SUBCATEGORY_MAP = {
|
|||||||
"mangadex": {
|
"mangadex": {
|
||||||
"feed" : "Followed Feed",
|
"feed" : "Followed Feed",
|
||||||
},
|
},
|
||||||
|
"nijie": {
|
||||||
|
"nuita" : "Nuita History",
|
||||||
|
},
|
||||||
"pinterest": {
|
"pinterest": {
|
||||||
"board": "",
|
"board": "",
|
||||||
"pinit": "pin.it Links",
|
"pinit": "pin.it Links",
|
||||||
|
|||||||
Reference in New Issue
Block a user