File size: 752 Bytes
6fff8e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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())