28 lines
943 B
Python
28 lines
943 B
Python
import asyncio
|
|
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()
|
|
|
|
# Intercept network requests
|
|
async def log_response(response):
|
|
try:
|
|
if 'api/guji' in response.url or 'chapter' in response.url:
|
|
text = await response.text()
|
|
print(f"URL: {response.url}\nData: {text[:500]}\n")
|
|
except:
|
|
pass
|
|
|
|
page.on("response", log_response)
|
|
|
|
print("Navigating to shidianguji...")
|
|
await page.goto("https://www.shidianguji.com/book/CADAL02059421/chapter/1lmkv0n02yhom?version=2", wait_until="networkidle")
|
|
await page.wait_for_timeout(3000)
|
|
|
|
await browser.close()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|