Skip to content

Commit

Permalink
✨ B站获取OPUS格式动态 (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
AzideCupric authored Nov 6, 2024
1 parent d10db08 commit 8ab60d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nonebot_bison/platform/bilibili/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def parse_target(cls, target_text: str) -> Target:
@retry_for_352
async def get_sub_list(self, target: Target) -> list[DynRawPost]:
client = await self.ctx.get_client(target)
params = {"host_mid": target, "timezone_offset": -480, "offset": ""}
params = {"host_mid": target, "timezone_offset": -480, "offset": "", "features": "itemOpusStyle"}
res = await client.get(
"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space",
params=params,
Expand Down
6 changes: 3 additions & 3 deletions tests/platforms/test_bilibili.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ async def test_fetch_new_without_dynamic(bilibili, dummy_user_subinfo, without_d

target = Target("161775300")
post_router = respx.get(
f"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?host_mid={target}&timezone_offset=-480&offset="
f"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?host_mid={target}&timezone_offset=-480&offset=&features=itemOpusStyle"
)
post_router.mock(return_value=Response(200, json=without_dynamic))
res = await bilibili.fetch_new_post(SubUnit(target, [dummy_user_subinfo]))
Expand All @@ -433,7 +433,7 @@ async def test_fetch_new(bilibili, dummy_user_subinfo):
target = Target("161775300")

post_router = respx.get(
f"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?host_mid={target}&timezone_offset=-480&offset="
f"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?host_mid={target}&timezone_offset=-480&offset=&features=itemOpusStyle"
)
post_list = type_validate_python(PostAPI, get_json("bilibili-new.json"))
assert post_list.data
Expand Down Expand Up @@ -477,7 +477,7 @@ async def test_fetch_new_live_rcmd(bilibili: "Bilibili", dummy_user_subinfo):
target = Target("13164144")

post_router = respx.get(
f"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?host_mid={target}&timezone_offset=-480&offset="
f"https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?host_mid={target}&timezone_offset=-480&offset=&features=itemOpusStyle"
)
post_list = type_validate_python(PostAPI, get_json("bilibili-dynamic-live-rcmd.json"))
assert post_list.data
Expand Down

0 comments on commit 8ab60d6

Please sign in to comment.