How to see API call of websites in Chrome using Python? Alternatively, for a slightly more conversational to

22 Replies, 2243 Views

Pyppeteer is actually a great choice for this! It’s a Python port of Puppeteer, so it’s perfect for scraping API calls.

Example:
```python
import asyncio
from pyppeteer import launch

async def main():
browser = await launch()
page = await browser.newPage()
await page.goto('https://example.com')
await page.waitFor(2000) # wait for calls
print(await page.evaluate('window.performance.getEntries()'))

asyncio.get_event_loop().run_until_complete(main())
```
This logs all network requests, including API calls.

Messages In This Thread



Users browsing this thread: 1 Guest(s)