Spaces:
Running
Running
Download dengtaishan-src/tools/tl.py from Ethscriptions/mx: direct link, hf CLI and curl.
- Browser
- Download file 752 Bytes
-
https://huggingface.co/spaces/Ethscriptions/mx/resolve/main/dengtaishan-src/tools/tl.py
- Command line
-
hf download hf://spaces/Ethscriptions/mx/dengtaishan-src/tools/tl.py
-
curl -L -o tl.py https://huggingface.co/spaces/Ethscriptions/mx/resolve/main/dengtaishan-src/tools/tl.py
752 Bytes
| import asyncio, json | |
| 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() | |
| await pg.goto("http://localhost:5173/preview/production/1b822e06-b78d-4352-884d-1f8fddabf546/?still=0&w=100") | |
| await pg.wait_for_function("document.title==='ready'", timeout=60000) | |
| tl = await pg.evaluate("window.TL") | |
| json.dump(tl, open('/tmp/tl.json','w'), ensure_ascii=False) | |
| print('duration', tl['duration']) | |
| for s in tl['scenes']: | |
| print(s['id'], round(s['start'],1), round(s['end'],1), ' '.join(f"{l['id']}@{l['start']:.1f}" for l in s['lines'])) | |
| await b.close() | |
| asyncio.run(main()) | |