Convert browser automations to direct API calls for speed and reliability.
window.fetch with call-stack inspectionpage.on('response', ...)) to capture API data without making extra requests.1Use the Libretto skill. We have a browser script at ./integration.ts that automates going to Hacker News and getting the first 10 posts. Convert it to direct network requests instead.
123# What the agent runs npx libretto run ./integration.ts jq . .libretto/sessions/conversion-flow/network.jsonl
page.on('response', ...) listener and let the site's own code make the requests. Zero detection risk because no extra requests are made, but you're limited to whatever requests the site naturally triggers. Safer, but less flexible. Use this when the site has bot protection.Use passive interception, I don't want to risk triggering their bot detection.
The original script also grabbed the comment count, but the new version doesn't fetch that field from the API.
12# What the agent runs npx libretto run ./integration.ts --headless
The scores are all null. It looks like the API response has a different field name for that.