Spaces:
Sleeping
Sleeping
import asyncio | |
from playwright.async_api import async_playwright | |
async def fetch_train_info(): | |
async with async_playwright() as p: | |
browser = await p.chromium.launch() | |
page = await browser.new_page() | |
await page.goto("https://traininfo.jreast.co.jp/train_info/kanto.aspx") | |
await page.wait_for_timeout(5000) | |
content = await page.content() | |
train_info = await page.inner_text("body") | |
print(train_info) | |
await browser.close() | |
asyncio.run(fetch_train_info()) | |
exit() | |