Use this file to discover all available pages before exploring further.
Automate the extraction of financial data from investor relations websites by combining Stagehand for AI-powered browser automation with Reducto for PDF processing.
Step 2: Navigate and trigger download with AI actions
Use Stagehand’s AI-powered actions to navigate the page naturally using plain English instructions:
await client.sessions.navigate(id=session_id, url="https://www.apple.com/")await client.sessions.act( id=session_id, input="Click the 'Investors' button at the bottom of the page")await client.sessions.act( id=session_id, input="Scroll down to the Financial Data section of the page")await client.sessions.act( id=session_id, input="Under Quarterly Earnings Reports, click on '2025'")await client.sessions.act( id=session_id, input="Click the 'Financial Statements' link under Q4")
Browserbase automatically captures file downloads when links are clicked.
Browserbase returns downloads as a ZIP archive. Extract the PDF:
def extract_pdf_from_zip(zip_content): with zipfile.ZipFile(io.BytesIO(zip_content)) as zf: for filename in zf.namelist(): if filename.endswith(".pdf"): return zf.read(filename)
Upload the PDF to Reducto and extract structured financial data using a schema:
upload = reducto.upload(file=("report.pdf", pdf_content))# Define schema for iPhone net sales extractionschema = { "type": "object", "properties": { "report_period": { "type": "string", "description": "The fiscal quarter and year of the report" }, "iphone_net_sales": { "type": "object", "description": "iPhone net sales figures", "properties": { "current_quarter": { "type": "number", "description": "iPhone net sales for the current quarter in millions" }, "prior_year_quarter": { "type": "number", "description": "iPhone net sales for the same quarter last year in millions" }, "year_over_year_change": { "type": "number", "description": "Percentage change year over year" } } }, "total_net_sales": { "type": "object", "description": "Total company net sales", "properties": { "current_quarter": { "type": "number", "description": "Total net sales for the current quarter in millions" }, "prior_year_quarter": { "type": "number", "description": "Total net sales for the same quarter last year in millions" } } }, "iphone_percentage_of_total": { "type": "number", "description": "iPhone sales as a percentage of total net sales" } }}result = reducto.extract.run( input=upload.file_id, instructions={"schema": schema})