Skip to content

Commit

Permalink
fix2
Browse files Browse the repository at this point in the history
  • Loading branch information
upbit committed Mar 3, 2024
1 parent 27f5847 commit a082f1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
_Pixiv API for Python (with Auth supported)_

- [2024/03/03] _v3.7.5_ Fix `novel_text()` BUG, add `webview_novel()`, see
- [2024/03/03] _v3.7.5_ Fix `novel_text()` BUG, add `webview_novel()`, see
[#337](https://github.com/upbit/pixivpy/issues/337) (thanks
[@xiyihan](https://github.com/xiyihan0))
- [2023/09/18] _v3.7.3_ Add `novel_follow()`, fix ByPassSniApi() host BUG, see
Expand Down
2 changes: 1 addition & 1 deletion pixivpy3/aapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ def webview_novel(self, novel_id: int | str, raw: bool = False, req_auth: bool =
return r.text
try:
# extract JSON content
json_str = re.search(r"novel:\s({.+}),\s+isOwnWork", r.text).groups()[0].encode() # type: ignore
json_str = re.search(r"novel:\s({.+}),\s+isOwnWork", r.text).groups()[0].encode() # type: ignore
return self.parse_json(json_str)
except Exception as e:
raise PixivError("Extract novel content error: %s" % e, header=r.headers, body=r.text)
Expand Down
4 changes: 2 additions & 2 deletions pixivpy3/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import shutil
from datetime import datetime
from typing import IO, Any, Union
from typing import IO, Any

import cloudscraper # type: ignore[import]
from requests.structures import CaseInsensitiveDict
Expand Down Expand Up @@ -44,7 +44,7 @@ def set_accept_language(self, language: str) -> None:
self.additional_headers["Accept-Language"] = language

@classmethod
def parse_json(cls, json_str: Union[str, bytes, Any]) -> ParsedJson:
def parse_json(cls, json_str: str | bytes) -> ParsedJson:
"""parse str into JsonDict"""
return json.loads(json_str, object_hook=JsonDict)

Expand Down

0 comments on commit a082f1d

Please sign in to comment.