Ethscriptions's picture
登泰山记:渲染引擎、九个篇章场景、程序化配乐音效、MP4 导出、发布文案与封面(初版)
6fff8e3 verified
Raw History Blame Contribute Delete
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())