[nijie] add doujin extractor
adds support for "https://nijie.info/members_dojin.php?id=<artist_id>"
This commit is contained in:
@@ -149,8 +149,8 @@ class FlickrGalleryExtractor(FlickrExtractor):
|
||||
r"photos/([^/]+)/galleries/(\d+)"]
|
||||
test = [(("https://www.flickr.com/photos/flickr/"
|
||||
"galleries/72157681572514792/"), {
|
||||
"url": "97dd9640b09384f313845b784046da410f70aee6",
|
||||
"keyword": "8b11026066ec86290ae18833859623ee5b52d363",
|
||||
"url": "1e0e300fa5fe8c49ba5dfa7ccca0cb0da8a04f93",
|
||||
"keyword": "29addd2523493cb3a83ea16c8c1439cbd2f2da97",
|
||||
})]
|
||||
|
||||
def __init__(self, match):
|
||||
|
||||
@@ -22,10 +22,10 @@ class NijieExtractor(AsynchronousExtractor):
|
||||
cookiedomain = "nijie.info"
|
||||
popup_url = "https://nijie.info/view_popup.php?id="
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, match=None):
|
||||
AsynchronousExtractor.__init__(self)
|
||||
self.session.headers["Referer"] = "https://nijie.info/"
|
||||
self.artist_id = ""
|
||||
self.artist_id = match.group(1) if match else None
|
||||
|
||||
def items(self):
|
||||
self.login()
|
||||
@@ -81,6 +81,19 @@ class NijieExtractor(AsynchronousExtractor):
|
||||
raise exception.AuthenticationError()
|
||||
return self.session.cookies
|
||||
|
||||
def _pagination(self, path):
|
||||
url = "https://nijie.info/" + path
|
||||
params = {"id": self.artist_id, "p": 1}
|
||||
while True:
|
||||
response = self.request(url, params=params, fatal=False)
|
||||
if response.status_code == 404:
|
||||
raise exception.NotFoundError("artist")
|
||||
ids = list(text.extract_iter(response.text, ' illust_id="', '"'))
|
||||
yield from ids
|
||||
if len(ids) < 48:
|
||||
return
|
||||
params["p"] += 1
|
||||
|
||||
|
||||
class NijieUserExtractor(NijieExtractor):
|
||||
"""Extractor for works of a nijie-user"""
|
||||
@@ -97,22 +110,23 @@ class NijieUserExtractor(NijieExtractor):
|
||||
}),
|
||||
]
|
||||
|
||||
def __init__(self, match):
|
||||
NijieExtractor.__init__(self)
|
||||
self.artist_id = match.group(1)
|
||||
def get_image_ids(self):
|
||||
return self._pagination("members_illust.php")
|
||||
|
||||
|
||||
class NijieDoujinExtractor(NijieExtractor):
|
||||
"""Extractor for doujin entries of a nijie-user"""
|
||||
subcategory = "doujin"
|
||||
pattern = [(r"(?:https?://)?(?:www\.)?nijie\.info/"
|
||||
r"members_dojin\.php\?id=(\d+)")]
|
||||
test = [
|
||||
("https://nijie.info/members_dojin.php?id=6782", {
|
||||
"count": ">= 18",
|
||||
})
|
||||
]
|
||||
|
||||
def get_image_ids(self):
|
||||
params = {"id": self.artist_id, "p": 1}
|
||||
url = "https://nijie.info/members_illust.php"
|
||||
while True:
|
||||
response = self.request(url, params=params, fatal=False)
|
||||
if response.status_code == 404:
|
||||
raise exception.NotFoundError("artist")
|
||||
ids = list(text.extract_iter(response.text, ' illust_id="', '"'))
|
||||
yield from ids
|
||||
if len(ids) < 48:
|
||||
return
|
||||
params["p"] += 1
|
||||
return self._pagination("members_dojin.php")
|
||||
|
||||
|
||||
class NijieImageExtractor(NijieExtractor):
|
||||
|
||||
@@ -21,6 +21,7 @@ TRAVIS_SKIP = {
|
||||
|
||||
# temporary issues, etc.
|
||||
BROKEN = {
|
||||
"loveisover", # "Name or service not known"
|
||||
"mangahere", # invalid SSL cert
|
||||
"puremashiro", # online reader down
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user