@@ -224,21 +224,21 @@ def _validate(response):
|
|||||||
class KemonopartyUserExtractor(KemonopartyExtractor):
|
class KemonopartyUserExtractor(KemonopartyExtractor):
|
||||||
"""Extractor for all posts from a kemono.party user listing"""
|
"""Extractor for all posts from a kemono.party user listing"""
|
||||||
subcategory = "user"
|
subcategory = "user"
|
||||||
pattern = USER_PATTERN + r"/?(?:\?o=(\d+))?(?:$|[?#])"
|
pattern = USER_PATTERN + r"/?(?:\?([^#]+))?(?:$|[?#])"
|
||||||
example = "https://kemono.party/SERVICE/user/12345"
|
example = "https://kemono.party/SERVICE/user/12345"
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
_, _, service, user_id, offset = match.groups()
|
_, _, service, user_id, self.query = match.groups()
|
||||||
self.subcategory = service
|
self.subcategory = service
|
||||||
KemonopartyExtractor.__init__(self, match)
|
KemonopartyExtractor.__init__(self, match)
|
||||||
self.api_url = "{}/api/v1/{}/user/{}".format(
|
self.api_url = "{}/api/v1/{}/user/{}".format(
|
||||||
self.root, service, user_id)
|
self.root, service, user_id)
|
||||||
self.user_url = "{}/{}/user/{}".format(self.root, service, user_id)
|
self.user_url = "{}/{}/user/{}".format(self.root, service, user_id)
|
||||||
self.offset = text.parse_int(offset)
|
|
||||||
|
|
||||||
def posts(self):
|
def posts(self):
|
||||||
url = self.api_url
|
url = self.api_url
|
||||||
params = {"o": self.offset}
|
params = text.parse_query(self.query)
|
||||||
|
params["o"] = text.parse_int(params.get("o"))
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
posts = self.request(url, params=params).json()
|
posts = self.request(url, params=params).json()
|
||||||
|
|||||||
@@ -25,6 +25,19 @@ __tests__ = (
|
|||||||
"#count" : range(200, 300),
|
"#count" : range(200, 300),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://kemono.party/fanbox/user/6993449?q=お蔵入りになった",
|
||||||
|
"#comment" : "search / 'q' query parameter (#3385, #4057)",
|
||||||
|
"#category": ("", "kemonoparty", "fanbox"),
|
||||||
|
"#class" : kemonoparty.KemonopartyUserExtractor,
|
||||||
|
"#urls" : (
|
||||||
|
"https://kemono.party/data/ef/7b/ef7b4398a2f4ada597421fd3c116cff86e85695911f7cd2a459b0e566b864e46.png",
|
||||||
|
"https://kemono.party/data/73/e6/73e615f6645b9d1af6329448601673c9275f07fd11eb37670c97e307e29a9ee9.png",
|
||||||
|
),
|
||||||
|
|
||||||
|
"id": "8779",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://kemono.su/subscribestar/user/alcorart",
|
"#url" : "https://kemono.su/subscribestar/user/alcorart",
|
||||||
"#category": ("", "kemonoparty", "subscribestar"),
|
"#category": ("", "kemonoparty", "subscribestar"),
|
||||||
|
|||||||
Reference in New Issue
Block a user