from typing import TypedDictfrom playwright.async_api import Pagefrom intuned_browser import extract_markdownclass Params(TypedDict): passasync def automation(page: Page, params: Params, **_kwargs): await page.goto("https://books.toscrape.com/") header_locator = page.locator('h1').first # First title on the page markdown = await extract_markdown(header_locator) # Extract markdown from the first title print(markdown) return markdown
The source of the HTML content. When a Page is provided, extracts from the entire page. When a Locator is provided, extracts from that specific element.