Skip to content

Commit

Permalink
修复了网页动态可能获取不到tag的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Polyisoprene committed Feb 9, 2023
1 parent efc94da commit 6e55936
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dynamicadaptor/DynamicConversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,10 @@ async def web_formate(message: dict) -> RenderMessage:

try:
text = message["modules"]["module_dynamic"]["desc"]
if text:
if text is not None:
text["topic"] = message["modules"]["module_dynamic"]["topic"]
else:
text = None
text = {"topic":message["modules"]["module_dynamic"]["topic"]}
except KeyError:
text = None

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "DynamicAdaptor"
version = "0.3.6"
version = "0.3.7"
description = ""
authors = ["DMC <lzxder@outlook.com>"]
readme = "README.md"
Expand Down
6 changes: 3 additions & 3 deletions tests/web_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

async def run():
# dyn_id = "75570329698487509"
url = "https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?timezone_offset=-480&id=755703296984875092&features=itemOpusStyle"
url = "https://api.bilibili.com/x/polymer/web-dynamic/v1/detail?timezone_offset=-480&id=760523624703590658&features=itemOpusStyle"
headers = {
"referer": "https://t.bilibili.com/75570329698487509",
"referer": "https://t.bilibili.com/760523624703590658",
"origin":"https://t.bilibili.com"
}
res = httpx.get(url, headers=headers).json()
# print(res)
result = await formate_message("web", res["data"]["item"])
print(result.forward.major)
print(result.text)

if __name__ == "__main__":

Expand Down

0 comments on commit 6e55936

Please sign in to comment.