#!/usr/bin/env python3 """Intercept API calls to find where lot data comes from""" import asyncio import json from playwright.async_api import async_playwright async def main(): async with async_playwright() as p: browser = await p.chromium.launch(headless=False) page = await browser.new_page() # Track API calls api_calls = [] async def handle_response(response): if 'api' in response.url.lower() or 'graphql' in response.url.lower(): try: body = await response.json() api_calls.append({ 'url': response.url, 'status': response.status, 'body': body }) print(f"\nAPI CALL: {response.url}") print(f"Status: {response.status}") if 'lot' in response.url.lower() or 'auction' in response.url.lower(): print(f"Body preview: {json.dumps(body, indent=2)[:500]}") except: pass page.on('response', handle_response) # Visit auction page print("Loading auction page...") await page.goto("https://www.troostwijkauctions.com/a/woonunits-generatoren-reinigingsmachines-en-zakelijke-goederen-A1-37889", wait_until='networkidle') # Wait a bit for lazy loading await asyncio.sleep(5) print(f"\n\nCaptured {len(api_calls)} API calls") await browser.close() if __name__ == "__main__": asyncio.run(main())