Skip to content

Commit c250048

Browse files
committed
fix(bilibili): some dynamic failed without itemOpusStyle feature
1 parent 10d5eb9 commit c250048

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/plugins/bilibili/plugins/dynamic/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ async def broadcast(dynamic: Dynamic):
176176
@backoff.on_exception(backoff.constant, TimeoutError, max_tries=3)
177177
async def render_screenshot(id_str: str) -> bytes:
178178
async with get_new_page() as page:
179-
await page.goto(f"https://t.bilibili.com/{id_str}")
179+
await page.goto(f"https://m.bilibili.com/opus/{id_str}")
180180

181+
await page.wait_for_load_state("domcontentloaded")
181182
await page.add_style_tag(
182183
content="""
183184
@font-face {
@@ -304,7 +305,10 @@ async def _(db: async_scoped_session, sess: EventSession):
304305
async def _(id_str: str):
305306
try:
306307
dynamic = raise_for_status(
307-
await client.get("/polymer/web-dynamic/v1/detail", params={"id": id_str})
308+
await client.get(
309+
"/polymer/web-dynamic/v1/detail",
310+
params={"id": id_str, "features": "itemOpusStyle"},
311+
)
308312
)["item"]
309313
except Exception:
310314
await handle_error("获取动态信息失败")

0 commit comments

Comments
 (0)