自動化
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内部に設置します。当社の自動化ビルダーはこれらを一度も有効にしないため、それが動かすプロフィールは手で操作したものと見分けがつきません。相手のサイトがこれを調べるなら、手順はアプリ内で組んでください。