Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update aapi.py #276

Merged
merged 6 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Solomon-Edwards marked this conversation as resolved.
Show resolved Hide resolved
) -> 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