자동화
Puppeteer와 Playwright를 프로필에 바로
열려 있는 프로필마다 전용 디버깅 주소가 있습니다. 바로 그 프로필에 코드를 연결하세요. 지문도 쿠키도 프록시도 그대로입니다. 무료 요금제를 포함한 모든 요금제에 들어 있습니다.
- 1앱에서 로컬 인터페이스를 켜세요. 설정의 «로컬 API»에서 키를 복사합니다.
- 2프로필을 열어 달라고 요청하세요. 응답에는 그 프로필만의 주소가 들어 있습니다.
- 3그 주소에 평범한 브라우저처럼 코드를 연결하세요.
- 4평소대로 작업하세요. 지문과 쿠키와 프록시는 이미 자리에 있습니다.
JavaScript (puppeteer-core)
const puppeteer = require('puppeteer-core');
(async () => {
// 1. Ask the app for this profile's debugging endpoint.
const started = await fetch(
'http://127.0.0.1:50325/api/v1/browser/start?profileId=YOUR_PROFILE_ID',
{ method: 'POST', headers: { 'x-api-token': 'YOUR_API_TOKEN' } },
).then((r) => r.json());
// 2. Attach to it like to any other browser.
const browser = await puppeteer.connect({
browserWSEndpoint: started.data.ws,
defaultViewport: null,
});
const [page] = await browser.pages();
await page.goto('https://example.com');
})();
Python (Playwright)
import requests
from playwright.sync_api import sync_playwright
# 1. Ask the app for this profile's debugging endpoint.
started = requests.post(
"http://127.0.0.1:50325/api/v1/browser/start",
params={"profileId": "YOUR_PROFILE_ID"},
headers={"x-api-token": "YOUR_API_TOKEN"},
).json()
# 2. Attach to it like to any other browser.
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(started["data"]["ws"])
page = browser.contexts[0].pages[0]
page.goto("https://example.com")
연결하기 전에 알아두실 것
Puppeteer와 Playwright는 연결되는 순간 Runtime.enable과 Page.enable을 스스로 켭니다. 이 도메인들은 페이지 스크립트가 알아챌 수 있는 관찰자를 Chromium 안에 심습니다. 저희 자동화 빌더는 이를 한 번도 켜지 않기 때문에, 그것이 조작하는 프로필은 손으로 다룬 프로필과 똑같아 보입니다. 상대 사이트가 이를 검사한다면 순서는 앱 안에서 구성하세요.