mx / dengtaishan-src /tools /r429.py
Ethscriptions's picture
登泰山记:旁白音频分批加载 + 自动重试(防限流),最终版
4adf7af verified
Raw History Blame Contribute Delete
656 Bytes
import asyncio
from playwright.async_api import async_playwright
async def main():
async with async_playwright() as p:
b = await p.chromium.launch()
pg = await b.new_page()
bad=[]; n=[0]
def on(r):
n[0]+=1
if r.status>=400: bad.append((r.status, r.url[:90]))
pg.on("response", on)
await pg.goto("https://ethscriptions-mx.static.hf.space/")
await pg.wait_for_timeout(15000)
print("responses", n[0]); [print(x) for x in bad[:20]]
print("voice ok?", await pg.evaluate("document.body.innerText.includes('旁白')"))
await b.close()
asyncio.run(main())