36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Check if viewing time is in the GraphQL response"""
|
|
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=True)
|
|
page = await browser.new_page()
|
|
|
|
responses = []
|
|
|
|
async def capture_response(response):
|
|
if 'graphql' in response.url and 'LotBiddingData' in await response.text():
|
|
try:
|
|
body = await response.json()
|
|
responses.append(body)
|
|
except:
|
|
pass
|
|
|
|
page.on('response', capture_response)
|
|
|
|
await page.goto("https://www.troostwijkauctions.com/l/%25282x%2529-duo-bureau-160x168-cm-A1-28505-5", wait_until='networkidle')
|
|
await asyncio.sleep(2)
|
|
|
|
if responses:
|
|
print("Full LotBiddingData Response:")
|
|
print("="*60)
|
|
print(json.dumps(responses[0], indent=2))
|
|
|
|
await browser.close()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|