跳转到主要内容
要将代理集成到您的代码中,请访问 API 示例页面,可通过您的 Zone 设置中的 “access parameters” 进入:integrate-new-proxy.gif在此页面,您可以选择大多数现代编程语言的集成示例,只需选择集成类型、代理 Zone、编程语言等,页面就会自动生成可直接使用的代码片段。
查看上面提到的 API 示例 页面中的一些示例(在 “language” 下拉菜单中选择 “other software”),或访问我们的 集成页面,其中包含最流行工具的代理集成指南。重要说明:如果您使用 Bright Data 的 Unlocker API、住宅代理或 SERP API,则可能需要使用我们的 SSL 证书以启用端到端加密连接。请参阅此处的说明我们为最常用的工具准备了详细指南。以下是链接列表:BrowserScan http://docs.brightdata.com/cn/integrations/browserscan
XLogin http://docs.brightdata.com/cn/integrations/xlogin
GeeLark http://docs.brightdata.com/cn/integrations/geelark
Puppeteer http://docs.brightdata.com/cn/integrations/puppeteer
Playwright http://docs.brightdata.com/cn/integrations/playwright
Selenium http://docs.brightdata.com/cn/integrations/selenium
AdsPower http://docs.brightdata.com/cn/integrations/adspower
Dolphin Anty http://docs.brightdata.com/cn/integrations/dolphin-anty
Incogniton http://docs.brightdata.com/cn/integrations/incogniton
Marketerbrowser http://docs.brightdata.com/cn/integrations/marketerbrowser
SMLOGIN http://docs.brightdata.com/cn/integrations/smlogin
Hidemyacc http://docs.brightdata.com/cn/integrations/hidemyacc
OpenBullet http://docs.brightdata.com/cn/integrations/openbullet
Switchyomega http://docs.brightdata.com/cn/integrations/switchyomega
PhantomBuster http://docs.brightdata.com/cn/integrations/phantombuster
BitBrowser http://docs.brightdata.com/cn/integrations/bitbrowser
Maskfog http://docs.brightdata.com/cn/integrations/maskfog
Ghost Browser http://docs.brightdata.com/cn/integrations/ghost-browser
Postman http://docs.brightdata.com/cn/integrations/postman
NGINX http://docs.brightdata.com/cn/integrations/nginx
StablerSOLO http://docs.brightdata.com/cn/integrations/stablersolo
VMLogin http://docs.brightdata.com/cn/integrations/vmlogin
GoLogin http://docs.brightdata.com/cn/integrations/gologin
Windows http://docs.brightdata.com/cn/integrations/windows
Scrapy http://docs.brightdata.com/cn/integrations/scrapy
AEZAKMI http://docs.brightdata.com/cn/integrations/aezakmi
Beautifulsoup http://docs.brightdata.com/cn/integrations/beautifulsoup
WebHarvy http://docs.brightdata.com/cn/integrations/webharvy
Ubuntu http://docs.brightdata.com/cn/integrations/ubuntu
Lalicat http://docs.brightdata.com/cn/integrations/lalicat
Multilogin http://docs.brightdata.com/cn/integrations/multilogin
Undetectable http://docs.brightdata.com/cn/integrations/undetectable
Apify http://docs.brightdata.com/cn/integrations/apify
iPhone http://docs.brightdata.com/cn/integrations/ios
MuLogin http://docs.brightdata.com/cn/integrations/mulogin
Changedetection http://docs.brightdata.com/cn/integrations/changedetection
Morelogin http://docs.brightdata.com/cn/integrations/morelogin
Proxifier http://docs.brightdata.com/cn/integrations/proxifier
Texau http://docs.brightdata.com/cn/integrations/texau
Android http://docs.brightdata.com/cn/integrations/android
Kameleo http://docs.brightdata.com/cn/integrations/kameleo
Screaming Frog http://docs.brightdata.com/cn/integrations/screaming-frog
Foxy http://docs.brightdata.com/cn/integrations/foxyproxy
SessionBox http://docs.brightdata.com/cn/integrations/sessionbox
Insomniac http://docs.brightdata.com/cn/integrations/insomniac
Helium Scraper http://docs.brightdata.com/cn/integrations/helium-scraper
SaleFreaks http://docs.brightdata.com/cn/integrations/salefreaks
Postern http://docs.brightdata.com/cn/integrations/postern
Antik http://docs.brightdata.com/cn/integrations/antik
Easync http://docs.brightdata.com/cn/integrations/easync
ParseHub http://docs.brightdata.com/cn/integrations/parsehub
Sphere Browser http://docs.brightdata.com/cn/integrations/sphere-browser
Octoparse http://docs.brightdata.com/cn/integrations/octoparse
ixBrowser http://docs.brightdata.com/cn/integrations/ixbrowser
Shadowrocket http://docs.brightdata.com/cn/integrations/shadowrocket
Firefox http://docs.brightdata.com/cn/integrations/firefox
Chrome http://docs.brightdata.com/cn/integrations/chrome
MacOS http://docs.brightdata.com/cn/integrations/macos
ClonBrowser http://docs.brightdata.com/cn/integrations/clonbrowser
Octo Browser http://docs.brightdata.com/cn/integrations/octobrowser
Genlogin http://docs.brightdata.com/cn/integrations/genlogin
Web Scraper http://docs.brightdata.com/cn/integrations/webscraper
如果您使用的工具未出现在列表中,并需要相关指南,请联系我们!
在发送请求时,在请求中您的 Zone 名称之后添加 -country 标志,并跟上该国家的两个字母的 ISO 代码在下面的示例中:我们添加了 -country-us,因此请求将从美国(“us”)发出。
curl "http://target.site" --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer_id>-zone-<zone_name>-country-us:<zone_password>
欧盟国家的分配是随机的。
适用于 DC、ISP 和 Unlocker/SERP API
您可以像“国家”一样,在请求中添加 -country-eu 来定位整个欧盟地区。使用 -country-eu 的请求将使用以下任一国家的 IP(这些国家自动包含在 “eu” 中):
AL, AZ, KG, BA, UZ, BI, XK, SM, DE, AT, CH, UK, GB, IE, IM, FR, ES, NL, IT, PT, BE, AD, MT, MC, MA, LU, TN, DZ, GI, LI, SE, DK, FI, NO, AX, IS, GG, JE, EU, GL, VA, FX, FO
若要定位特定城市,您需要使用 共享(按 IP 计费)专用 代理网络。在配置代理 Zone 时,选择国家后可以添加城市,以进一步细化地理位置定位。add-city.png点击 “Add city” 后,您将看到可定位的城市列表。若要查看特定位置的 可用 IP 数量配置完成后,您可以使用以下语法从指定城市发送请求:
curl "http://target.site" --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer_id>-zone-<zone_name>-country-<country>-city-<city>:<zone_password>
当选择双词城市时,其名称将在语法中写作一个单词。例如:定位 Buenos Aires 时,应写为:-country-ar-city-buenosaires
若需查看更多地理定位示例,您可查看我们的 代理集成示例页面
Bright Data 在全球所有国家提供代理,但以下国家除外:
  • 伊朗
  • 伊拉克
  • 叙利亚
  • 黎巴嫩
  • 巴勒斯坦
  • 朝鲜
  • 古巴
  • 苏丹
  • 俄罗斯克里米亚地区
如果您需要这些国家的代理,我们无法提供帮助。
事件日志将显示您账户中任意 Zone 的最近最多 200 条请求。在 Bright Data 控制面板的代理页面:https://brightdata.com/cp/zones转到 “Event Log” 标签:event-log.png显示的数据包括:
  • Date: 请求的时间
  • Zone: 使用的 Zone
  • Source IP: 请求发出的源 IP
  • URL: 请求访问的网站
  • Result: 请求成功或失败 event-log-headers.png
  • 您可以在代理用户名中添加 session 参数来实现此功能:
    brd.superproxy.io:33335 br-customer-<customer_id>-zone-<zone_name>-session-rand39484
    
    在线程启动时生成一个随机数,并在需要更换该线程连接所分配的 Proxy Peer(代理节点)时更改它。
  • Session ID 可以是任意随机字符串或计数器: 使用相同 Session 字符串的请求将尽可能使用同一个 Proxy Peer; 使用不同 Session 字符串的请求将分配不同的 Proxy Peers。
    • 若 Session ID 中包含以下字符将会导致报错:- " `
    • 此功能仅适用于代理产品,对 Unlocker API 等抓取自动化产品 不适用
  • 若要强制更换 IP,只需修改 Session ID 即可。
  • 如果当前分配的 Proxy Peer(出口节点 IP)不可用,Super Proxy 会在第一次请求时返回错误 “502 - No peers available”;第二次请求时,即使您没有更改 Session ID,它也会为您分配一个新的 peer。
  • Session IP 在空闲状态下可保持最长 5 分钟。若超过 5 分钟无请求,该 IP 将被释放回资源池。 若您希望保持更长时间,请每 30 秒发送一个小型的 keep-alive 请求,以防该 Session 的空闲时间超过 1 分钟。 此请求可以非常小,例如 /favicon.ico,甚至是返回 404 的请求(只要该 Web 服务器不会因为此请求而断开连接)。
Bright Data 允许定位以下 操作系统
curl --proxy-user brd-customer-<customer_id>-zone-<zone_name>-os-windows:<zone_password> --proxy brd.superproxy.io:33335 "<target_site>"
当使用 Bright Data 住宅代理网络时,有时您可能需要使用分配给您 Zone 的特定 IP。
  1. 发送测试请求,加入 --verbose-v 选项以查看详细日志:
curl "https://lumtest.com/myip.json" --verbose --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer_id>-zone-<zone_name>:<zone_password>
  1. 找到 x-brd-ip 响应头,并复制其值 x-brd-ip.png
  2. 添加 -ip- 标志,并使用复制的 hashed IP 值
  3. 发送测试请求并 检查响应
curl "https://lumtest.com/myip.json" --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer_id>-zone-<zone_name>-ip-<hashed-ip>:<zone_password>
我们建议使用 https://lumtest.com/myip.json 作为测试域,以检查您的 IP 凭证。
可在 Zone 配置中的 Geolocation Targeting 添加 ASN 参数来启用此功能。asn-targeting.png配置保存后,可在 Zone 凭证中加入 ASN 标志,例如:
curl --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer_id>-zone-<zone_name>-asn-<asn-number>:<zone_password> "<target_site>"
注意: ASN 号可从 这里 获取。
专用住宅 IP 可以 gIPs 的形式使用。它们可在 Zone 配置页面中通过选择 “Dedicated” IP 类型并配置数量进行分配,同时需要绑定特定域名。number-of-dedicated-gIPs.png保存配置后,选择 “Show allocated Dedicated residential IPs” 即可看到 gIP 的哈希值列表。show-allocated-dedicated-ips.png这些值可用于定位特定 gIP,例如:
curl --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer_id>-zone-<zone_name>-gip-<gip_hash_value>:<zone_password> "<target_site>"
当您在中国境外时
只需定位中国住宅代理即可:
curl --proxy brd.superproxy.io:33335 --proxy-user brd-customer-<customer_id>-zone-<zone_name>-country-cn:<zone_password> "<target_site>"
  • 您可以从以下列表中选择特定的运营商:
a1, aircel, airtel, att, celcom, chinamobile, claro, comcast, cox, digi, 
dt, docomo, dtac, etisalat, idea, kyivstar, meo, megafon, mtn, mtnza, mts,
optus, orange, qwest, reliance_jio, robi, sprint, telefonica, telstra, 
tmobile, tigo, tim, verizon, vimpelcom, vodacomza, vodafone, vivo, zain,
vivabo, telenormyanmar, kcelljsc, swisscom, singtel, asiacell, windit, 
cellc, ooredoo, drei, umobile, cableone, proximus,tele2, mobitel, o2, 
bouygues, free, sfr, digicel
  • 示例:
brd-customer-<customer_id>-zone-<zone_name>-carrier-dt

对于单步骤抓取:

SERP API 是专为抓取 SERPs 而设计的理想产品,具有保证成功率(仅为成功付费)、主动解封、自动选择最佳代理、自定义请求头、指纹、CAPTCHA 解决等功能。

对于多步骤抓取(playwright/puppeteer/selenium):

Browser API 是最佳选择,它是完全云托管的浏览器,可让您专注于多步骤数据采集,而我们负责完整的代理与解封基础设施,包括 CAPTCHA 解决等。
Residential Proxy —— 不能。SERP API 是抓取 SERPs 的理想产品,具有保证成功率(仅为成功付费)、主动解封、自动选择最佳代理、自定义请求头、指纹、CAPTCHA 解决等功能。
从 Residential 网络抓取 Google SERPs 会触发 Super-proxy bypass,这会导致请求通过 Bright Data 服务器发送,而不是通过 peer 节点。
Datacenter & ISP Proxies —— 不能。 当尝试通过这些代理网络抓取 Google 时,请求会被拒绝,并收到以下响应头中的错误信息:
HTTP/1.1 403 Search engine host is not allowed
X-Luminati-Error: Forbidden: This target URL isn't supported on proxy networks, use the SERP API product for targeting this URL. You may contact your account manager or open a support ticket for assistance
当通过 Residential 或 Mobile 网络抓取搜索引擎时,请求不会通过 Residential 或 Mobile peer,而是直接通过 super proxy。
这样做的原因是为了支持浏览器环境中的 Residential 和 Mobile 网络集成,因为浏览器可能需要加载来自目标站点的搜索引擎资源端点。
如果您在 Residential 或 Mobile 网络中访问搜索引擎域名,请求将直接通过 super proxy,并会出现以下响应头作为指示:
x-luminati-ip: superproxy bypass
Bright Data 不允许以明文形式查看 Residential 和 Mobile 的 IP 地址。Datacenter 和 ISP Proxy 的 IP 则可以以明文形式查看。当您发送请求时,在响应头中会看到 x-brd-ip。该响应头包含一个唯一的哈希值,用于表示您在此次请求中实际使用的 IP 地址。