[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+)"]
|
r"photos/([^/]+)/galleries/(\d+)"]
|
||||||
test = [(("https://www.flickr.com/photos/flickr/"
|
test = [(("https://www.flickr.com/photos/flickr/"
|
||||||
"galleries/72157681572514792/"), {
|
"galleries/72157681572514792/"), {
|
||||||
"url": "97dd9640b09384f313845b784046da410f70aee6",
|
"url": "1e0e300fa5fe8c49ba5dfa7ccca0cb0da8a04f93",
|
||||||
"keyword": "8b11026066ec86290ae18833859623ee5b52d363",
|
"keyword": "29addd2523493cb3a83ea16c8c1439cbd2f2da97",
|
||||||
})]
|
})]
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
|
|||||||
@@ -22,10 +22,10 @@ class NijieExtractor(AsynchronousExtractor):
|
|||||||
cookiedomain = "nijie.info"
|
cookiedomain = "nijie.info"
|
||||||
popup_url = "https://nijie.info/view_popup.php?id="
|
popup_url = "https://nijie.info/view_popup.php?id="
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, match=None):
|
||||||
AsynchronousExtractor.__init__(self)
|
AsynchronousExtractor.__init__(self)
|
||||||
self.session.headers["Referer"] = "https://nijie.info/"
|
self.session.headers["Referer"] = "https://nijie.info/"
|
||||||
self.artist_id = ""
|
self.artist_id = match.group(1) if match else None
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
self.login()
|
self.login()
|
||||||
@@ -81,6 +81,19 @@ class NijieExtractor(AsynchronousExtractor):
|
|||||||
raise exception.AuthenticationError()
|
raise exception.AuthenticationError()
|
||||||
return self.session.cookies
|
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):
|
class NijieUserExtractor(NijieExtractor):
|
||||||
"""Extractor for works of a nijie-user"""
|
"""Extractor for works of a nijie-user"""
|
||||||
@@ -97,22 +110,23 @@ class NijieUserExtractor(NijieExtractor):
|
|||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, match):
|
def get_image_ids(self):
|
||||||
NijieExtractor.__init__(self)
|
return self._pagination("members_illust.php")
|
||||||
self.artist_id = match.group(1)
|
|
||||||
|
|
||||||
|
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):
|
def get_image_ids(self):
|
||||||
params = {"id": self.artist_id, "p": 1}
|
return self._pagination("members_dojin.php")
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
class NijieImageExtractor(NijieExtractor):
|
class NijieImageExtractor(NijieExtractor):
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ TRAVIS_SKIP = {
|
|||||||
|
|
||||||
# temporary issues, etc.
|
# temporary issues, etc.
|
||||||
BROKEN = {
|
BROKEN = {
|
||||||
|
"loveisover", # "Name or service not known"
|
||||||
"mangahere", # invalid SSL cert
|
"mangahere", # invalid SSL cert
|
||||||
"puremashiro", # online reader down
|
"puremashiro", # online reader down
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user