स्वचालन
Puppeteer और Playwright, सीधे आपकी प्रोफ़ाइलों में
हर खुली प्रोफ़ाइल का अपना डिबग पता होता है। अपना कोड ठीक उसी प्रोफ़ाइल से जोड़िए: उसके फ़िंगरप्रिंट, उसकी कुकीज़, उसके प्रॉक्सी के साथ। यह हर प्लान में है, मुफ़्त वाले में भी।
- 1प्रोग्राम में स्थानीय इंटरफ़ेस चालू कीजिए: सेटिंग्स, «Local 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 and Playwright turn on Runtime.enable and Page.enable the moment they attach. Runtime.enable puts observers inside Chromium that page scripts can notice. Our own automation builder never turns it on. It turns on Page.enable only while a flow runs, on the tabs the flow uses, so it can answer a page's alert or confirm; a test page that looks for traces saw nothing from it on either engine. If the site you work with checks for this, build the sequence in the app instead.
या बिना कोड लिखे ही कर लीजिए
एक विंडो में सोलह तरह के कदम: खोलें, दबाएँ, लिखें, रुकें, पढ़ें, शाखा बनाएँ। कोई पकड़ में आने वाला पर्यवेक्षक नहीं, और कुछ भी नहीं लगाना पड़ता।
देखिए प्रोग्राम क्या करता है