Playwright 代理集成

Playwright 代理集成

Bright Data 新产品:抓取浏览器

兼容 Playwright
轻松调用 API 来获取任意数量的浏览器会话,并使用 Puppeteer (Python)、Playwright (Node.js) 或 Selenium 通过 CDP 协议与它们交互。非常适合需要网站交互来检索数据的抓取项目,例如将鼠标悬停在页面上、点击按钮、滚动、添加文本等。

了解有关抓取浏览器的更多信息

将 Playwright 代理与 Bright Data 集成

  • 首先进入 “Bright Data 控制面板”,点击“创建区域”。
  • 选择“网络类型”,然后点击“保存”。
  • 在 Playwright 中的 “proxy-server” 值字段填写 “Proxy IP:Port” 信息,例如 brd.superproxy.io: 22225
  • 在 “page.authenticate” 中的 “username” 值字段输入您的 Bright Data 账户 ID 和代理区域名称,例如:BRD-customer-zone-yourZone 以及您在区域设置中找到的区域密码。
  • 例如:
      const playwright = require('playwright');

const options = {
proxy: {
server: 'http://brd.superproxy.io:22225',
username: 'brd-customer-[customer_ID]-zone-[zone_name]',
password: '[zone_password]'
}
};

(async () => {
const browser = await playwright.chromium.launch(options);
const page = await browser.newPage();

await page.goto('http://lumtest.com/myip.json');

const content = await page.content();
console.log(content);

await browser.close();
})();

代理管理器与 Playwright 集成

  • 创建区域并指定您想使用的网络、IP 类型和 IP 数量。
  • 安装代理管理器
  • 点击“添加新代理”,选择所需的区域和设置,然后点击“保存”。
  • 在 Playwright 中的 “server” 参数字段输入本地 IP 和代理管理器端口(例如 127.0.0.1:24000)
    • 本地主机 IP 是 127.0.0.1
    • 代理管理器中创建的端口是 24XXX。例如 24000
  • 将用户名和密码值留空,因为 Bright Data 代理管理器已使用超级代理进行过身份验证。
  • 例如:
      const playwright = require('playwright');

const options = {
proxy: {
server: 'http://127.0.0.1:24000'
}
};

(async () => {
const browser = await playwright.chromium.launch(options);
const page = await browser.newPage();

await page.goto('http://lumtest.com/myip.json');

const content = await page.content();
console.log(content);

await browser.close();
})();

获取Playwright的代理

满足各种需求的代理类型


动态住宅代理

  • 7200万+ IPs
  • 覆盖195 国家
  • 最大的轮替对等式IP网络
  • 访问和抓取复杂的网站

数据中心代理

  • 160万+ IPs
  • 覆盖 98 个国家
  • 可选共享或专用IP池
  • 快速访问较单纯的网站

ISP静态住宅代理

  • 60万+ IPs
  • 覆盖35个国家
  • 非轮替式纯静态住宅IP
  • 最适合登录多个帐户

移动代理

  • 7百万+ IPs
  • 覆盖 195 个国家
  • 真实合法3G/4G IP网络
  • 验证广告&抓取移动网站

业界最佳的客户体验

您提出要求,我们负责开发

每天发布新功能

24/7 全天候全球支持

随时解答你的任何问题

完全透明

实时的网络性能仪表板

专属客户经理

优化性能

定制解决方案

满足你的数据挖掘目标

代理和数据挖掘领域行业领导者

每天收集650TB的公共数据

每天发布新功能

为世界排名前十的大学中的七所提供服务

Trustpilot评分4.6(满分 5)

准备好获取Playwright代理了吗?