Skip to content

Commit

Permalink
🐛 fix weibo param
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Nov 9, 2024
1 parent 0ddccf9 commit d44747b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def __wrapper__(event: AvillaEvent, serv: RaianBotService, ctx: Context):
return True
account_routes = group.accounts.copy()
for account in group.accounts:
if Selector.from_follows_pattern(account) not in event.context.avilla.accounts:
if Selector.from_follows_pattern(account) not in event.context.account.avilla.accounts:
account_routes.remove(account)
if len(account_routes) < 2:
return True
Expand Down
13 changes: 5 additions & 8 deletions plugins/weibo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def _handle_dynamic(
async with pw.page(viewport={"width": 800, "height": 2400}) as page:
try:
await page.click("html")
await page.goto(data.url, timeout=10000, wait_until="networkidle")
await page.goto(data.url, timeout=20000, wait_until="networkidle")
elem = page.locator(
"//div[@class='card-wrap']", has=page.locator("//header[@class='weibo-top m-box']")
).first
Expand All @@ -100,15 +100,12 @@ async def _handle_dynamic(

imgs: list[Picture] = []
for url in data.img_urls:
if url_imgs:
imgs.append(Picture(UrlResource(url)))
continue
async with api.session.get(url) as resp:
if not bot.config.platform.tencentcloud:
imgs.append(Picture(RawResource(await resp.read())))
else:
if url_imgs and bot.config.platform.tencentcloud:
url = await bot.upload_to_cos(await resp.read(), f"weibo_dym_{token_hex(16)}.png")
imgs.append(Picture(UrlResource(url)))
else:
imgs.append(Picture(RawResource(await resp.read())))
return first, imgs


Expand Down Expand Up @@ -205,7 +202,7 @@ async def wfetch(
select: Match[int],
pw: PlaywrightService,
index: Query[int] = Query("动态.index", -1),
page: Query[int] = Query("动态.page", -1),
page: Query[int] = Query("动态.page", 1),
):
try:
prof = await api.get_profile_by_name(user.result, index=select.result, save=False, cache=True)
Expand Down

0 comments on commit d44747b

Please sign in to comment.