Skip to content

Commit

Permalink
feat: Add novel_follow()
Browse files Browse the repository at this point in the history
  • Loading branch information
Solomon-Edwards authored Jul 27, 2023
1 parent aec177a commit f4ced62
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ def appapi_novel(aapi):
print(json_result)
print(">>> {}, novel_text: {}".format(novel.title, json_result.novel_text))

json_result = aapi.novel_follow()
print(json_result)
novel = json_result.novels[0]
print(
">>> %s, text_length: %s, series: %s"
% (novel.title, novel.text_length, novel.series)
)


def main():
# app-api
Expand Down
13 changes: 13 additions & 0 deletions pixivpy3/aapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,19 @@ def novel_new(
r = self.no_auth_requests_call("GET", url, params=params, req_auth=req_auth)
return self.parse_result(r)

# 正在关注的用户的新小说
# restrict: [public, private, all]
def novel_follow(
self,
restrict: _RESTRICT = "public",
offset: int | None = None,
req_auth: bool = True,
) -> ParsedJson:
url = "%s/v1/novel/follow" % self.hosts
params: dict[str, Any] = {"restrict": restrict, "offset": offset}
r = self.no_auth_requests_call("GET", url, params=params, req_auth=req_auth)
return self.parse_result(r)

# 小说正文
def novel_text(self, novel_id: int | str, req_auth: bool = True) -> ParsedJson:
url = "%s/v1/novel/text" % self.hosts
Expand Down

0 comments on commit f4ced62

Please sign in to comment.