[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-cn-playwright-lunhuan-daili":3},{"success":4,"payload":5,"related":82,"errors":164},true,{"id":6,"slug":7,"title":8,"excerpt":9,"body_html":10,"meta_title":11,"meta_description":12,"canonical_url":13,"canonical_override":14,"og_title":8,"og_description":12,"og_image_url":15,"faq_json":16,"key_takeaways":32,"allow_index":38,"noindex_google_only":38,"allow_follow":4,"published_at":39,"updated_at":40,"content_updated_at":41,"featured_image_url":42,"featured_image_alt":14,"card_image_url":43,"reading_time_minutes":44,"author":45,"categories":49,"tags":56,"alternates":68,"locale_paths":73,"views":81},22,"playwright-lunhuan-daili","Playwright中使用轮换代理：完整开发者指南","学习如何在 Playwright 中配置代理旋转 —— 默认代理, 隐形设置, 地理目标, 同时刮切, 以及有代码示例的生产准备模式 .","\u003Ch2>为什么要为代理服务器打拼游戏\u003C\u002Fh2>\u003Cp>Playwright是一个来自微软的现代浏览器自动化框架,支持Chrimium,Firefox,和WebKit. 与仅HTTP库不同,Playwright会制作完整页面——执行JavaScript,处理动态内容,通过拒绝原始HTTP请求的反机器人检查.\u003C\u002Fp>\u003Cp>与 \u003Ca href=\"\u002Fcn\u002Fblog\u002Fzhuzhai-vs-shujuzhongxin-vs-yidong-daili\">住宅代办\u003C\u002Fa>, Playwright 成为从被严密保护的网站收集数据的最有效工具之一. 本指南涵盖每个关卡的代理配置:浏览器全宽,按内容,以及每页——工作代码可以直接复制到您的项目中.\u003C\u002Fp>\u003Cblockquote>本指南假设您有代理用户账户 。 如果你是新来的代理,从 \u003Ca href=\"\u002Fcn\u002Fblog\u002Fshenme-shi-daili-fuwuqi\">什么是代理服务器?\u003C\u002Fa> 然后回顾一下我们 \u003Ca href=\"\u002Fcn\u002Fblog\u002Fzuijia-wangluo-caiji-daili-2026\">网络刮刮的最佳代理\u003C\u002Fa> 概览。\u003C\u002Fblockquote>\u003Ch2>安装和设置\u003C\u002Fh2>\u003Ch3>节点.js(初级)\u003C\u002Fh3>\u003Cpre>\u003Ccode># Install Playwright\nnpm init -y\nnpm install playwright\n# Download browser binaries\nnpx playwright install chromium\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Py\u003C\u002Fh3>\u003Cpre>\u003Ccode># Install Playwright for Python\npip install playwright\npython -m playwright install chromium\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>浏览器- 级别代理配置\u003C\u002Fh2>\u003Cp>最简单的方法是在浏览器发布时设置一个代理. 每个上下文和页面自动继承此代理.\u003C\u002Fp>\u003Ch3>节点.js - 浏览器-Wide代理\u003C\u002Fh3>\u003Cpre>\u003Ccode>const { chromium } = require('playwright');\n(async () => {\n  const browser = await chromium.launch({\n    proxy: {\n      server: 'http:\u002F\u002Fgate.proxyhat.com:8080',\n      username: 'USERNAME',\n      password: 'PASSWORD',\n    },\n  });\n  const page = await browser.newPage();\n  await page.goto('https:\u002F\u002Fhttpbin.org\u002Fip');\n  console.log(await page.textContent('body'));\n  await browser.close();\n})();\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Python - 浏览器- Wide 代理服务器\u003C\u002Fh3>\u003Cpre>\u003Ccode>from playwright.sync_api import sync_playwright\nwith sync_playwright() as p:\n    browser = p.chromium.launch(\n        proxy={\n            \"server\": \"http:\u002F\u002Fgate.proxyhat.com:8080\",\n            \"username\": \"USERNAME\",\n            \"password\": \"PASSWORD\",\n        }\n    )\n    page = browser.new_page()\n    page.goto(\"https:\u002F\u002Fhttpbin.org\u002Fip\")\n    print(page.text_content(\"body\"))\n    browser.close()\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>Per- Context 代理旋转\u003C\u002Fh2>\u003Cp>Playwright的真正力量在于 \u003Cstrong>浏览器上下文\u003C\u002Fstrong>。每个上下文都是一个孤立的会话——单独的饼干,存储和缓存——并且可以有自己的代理. 这是推荐的代理旋转模式,因为它避免了为每个IP启动新浏览器的间接费用.\u003C\u002Fp>\u003Ch3>节点(js)——按内容旋转\u003C\u002Fh3>\u003Cpre>\u003Ccode>const { chromium } = require('playwright');\nconst crypto = require('crypto');\nasync function createProxiedContext(browser) {\n  const sessionId = crypto.randomBytes(4).toString('hex');\n  const context = await browser.newContext({\n    proxy: {\n      server: 'http:\u002F\u002Fgate.proxyhat.com:8080',\n      username: `USERNAME-sid-${sessionId}`,\n      password: 'PASSWORD',\n    },\n  });\n  return context;\n}\n(async () => {\n  \u002F\u002F Launch browser WITHOUT a proxy — set it per context\n  const browser = await chromium.launch();\n  const urls = [\n    'https:\u002F\u002Fexample.com\u002Fpage\u002F1',\n    'https:\u002F\u002Fexample.com\u002Fpage\u002F2',\n    'https:\u002F\u002Fexample.com\u002Fpage\u002F3',\n  ];\n  for (const url of urls) {\n    const context = await createProxiedContext(browser);\n    const page = await context.newPage();\n    try {\n      await page.goto(url, { timeout: 30000 });\n      const content = await page.content();\n      console.log(`Fetched ${url} — ${content.length} chars`);\n    } catch (err) {\n      console.error(`Failed ${url}: ${err.message}`);\n    } finally {\n      await context.close(); \u002F\u002F Releases the session\n    }\n  }\n  await browser.close();\n})();\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Python —— 文字旋转\u003C\u002Fh3>\u003Cpre>\u003Ccode>import uuid\nfrom playwright.sync_api import sync_playwright\ndef create_proxied_context(browser):\n    session_id = uuid.uuid4().hex[:8]\n    context = browser.new_context(\n        proxy={\n            \"server\": \"http:\u002F\u002Fgate.proxyhat.com:8080\",\n            \"username\": f\"USERNAME-sid-{session_id}\",\n            \"password\": \"PASSWORD\",\n        }\n    )\n    return context\nwith sync_playwright() as p:\n    browser = p.chromium.launch()\n    urls = [\n        \"https:\u002F\u002Fexample.com\u002Fpage\u002F1\",\n        \"https:\u002F\u002Fexample.com\u002Fpage\u002F2\",\n        \"https:\u002F\u002Fexample.com\u002Fpage\u002F3\",\n    ]\n    for url in urls:\n        context = create_proxied_context(browser)\n        page = context.new_page()\n        try:\n            page.goto(url, timeout=30000)\n            print(f\"Fetched {url} — {len(page.content())} chars\")\n        except Exception as e:\n            print(f\"Failed {url}: {e}\")\n        finally:\n            context.close()\n    browser.close()\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>地理目标背景\u003C\u002Fh2>\u003Cp>在刮去本地化内容时,可以将ProxyHat的地理目标设置与Playwright的本地化和时区设置结合起来,以达到最大真实性. 见我们所有可用的地点 \u003Ca href=\"\u002Fcn\u002Flocations\">地点页面\u003C\u002Fa>。 。 。\u003C\u002Fp>\u003Cpre>\u003Ccode>const { chromium } = require('playwright');\nconst GEO_PROFILES = {\n  us: { locale: 'en-US', timezone: 'America\u002FNew_York',  country: 'us' },\n  de: { locale: 'de-DE', timezone: 'Europe\u002FBerlin',     country: 'de' },\n  jp: { locale: 'ja-JP', timezone: 'Asia\u002FTokyo',        country: 'jp' },\n};\nasync function createGeoContext(browser, region) {\n  const profile = GEO_PROFILES[region];\n  return browser.newContext({\n    proxy: {\n      server: 'http:\u002F\u002Fgate.proxyhat.com:8080',\n      username: `USERNAME-country-${profile.country}`,\n      password: 'PASSWORD',\n    },\n    locale: profile.locale,\n    timezoneId: profile.timezone,\n    geolocation: null,\n  });\n}\n(async () => {\n  const browser = await chromium.launch();\n  for (const region of ['us', 'de', 'jp']) {\n    const context = await createGeoContext(browser, region);\n    const page = await context.newPage();\n    await page.goto('https:\u002F\u002Fexample.com\u002Fpricing');\n    console.log(`${region.toUpperCase()}: ${await page.title()}`);\n    await context.close();\n  }\n  await browser.close();\n})();\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>与工人池同时擦拭\u003C\u002Fh2>\u003Cp>剧作家背景轻巧. 可以并行运行多个上下文,每个上下文都有不同的代理会话,以大幅提高吞吐量.\u003C\u002Fp>\u003Cpre>\u003Ccode>const { chromium } = require('playwright');\nconst crypto = require('crypto');\nconst MAX_CONCURRENCY = 5;\nasync function scrapeUrl(browser, url) {\n  const sessionId = crypto.randomBytes(4).toString('hex');\n  const context = await browser.newContext({\n    proxy: {\n      server: 'http:\u002F\u002Fgate.proxyhat.com:8080',\n      username: `USERNAME-sid-${sessionId}`,\n      password: 'PASSWORD',\n    },\n  });\n  const page = await context.newPage();\n  try {\n    await page.goto(url, { timeout: 30000, waitUntil: 'domcontentloaded' });\n    const title = await page.title();\n    return { url, title, success: true };\n  } catch (err) {\n    return { url, error: err.message, success: false };\n  } finally {\n    await context.close();\n  }\n}\nasync function scrapeAll(urls) {\n  const browser = await chromium.launch();\n  const results = [];\n  \u002F\u002F Process in batches of MAX_CONCURRENCY\n  for (let i = 0; i \u003C urls.length; i += MAX_CONCURRENCY) {\n    const batch = urls.slice(i, i + MAX_CONCURRENCY);\n    const batchResults = await Promise.all(\n      batch.map(url => scrapeUrl(browser, url))\n    );\n    results.push(...batchResults);\n    console.log(`Completed batch ${Math.floor(i \u002F MAX_CONCURRENCY) + 1}`);\n  }\n  await browser.close();\n  return results;\n}\n\u002F\u002F Usage\nconst urls = Array.from({ length: 20 }, (_, i) =>\n  `https:\u002F\u002Fexample.com\u002Fproduct\u002F${i + 1}`\n);\nscrapeAll(urls).then(results => {\n  const success = results.filter(r => r.success).length;\n  console.log(`Success: ${success}\u002F${results.length}`);\n});\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>关于更先进的货币模式,见我们的指南 \u003Ca href=\"\u002Fcn\u002Fblog\u002Fkuozhan-daili-qingqiu-bingfa-kongzhi\">用货币控制缩放代理请求\u003C\u002Fa>。 。 。\u003C\u002Fp>\u003Ch2>隐形配置\u003C\u002Fh2>\u003Cp>默认的 Playwright 浏览器有可探测的自动化标记. 这些设置会减少您的指纹, 帮助绕过 \u003Ca href=\"\u002Fcn\u002Fblog\u002Ffan-jiqi-ren-xitong-ruhe-jiance-daili\">反机器人系统\u003C\u002Fa>。 。 。\u003C\u002Fp>\u003Ch3>基本隐形设置\u003C\u002Fh3>\u003Cpre>\u003Ccode>const { chromium } = require('playwright');\n(async () => {\n  const browser = await chromium.launch({\n    args: [\n      '--disable-blink-features=AutomationControlled',\n      '--disable-features=IsolateOrigins,site-per-process',\n    ],\n  });\n  const context = await browser.newContext({\n    proxy: {\n      server: 'http:\u002F\u002Fgate.proxyhat.com:8080',\n      username: 'USERNAME',\n      password: 'PASSWORD',\n    },\n    userAgent: 'Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36 (KHTML, like Gecko) Chrome\u002F131.0.0.0 Safari\u002F537.36',\n    viewport: { width: 1920, height: 1080 },\n    locale: 'en-US',\n    timezoneId: 'America\u002FNew_York',\n    deviceScaleFactor: 1,\n    hasTouch: false,\n    isMobile: false,\n    javaScriptEnabled: true,\n  });\n  \u002F\u002F Remove automation markers\n  await context.addInitScript(() => {\n    \u002F\u002F Override navigator.webdriver\n    Object.defineProperty(navigator, 'webdriver', {\n      get: () => undefined,\n    });\n    \u002F\u002F Override navigator.plugins to look real\n    Object.defineProperty(navigator, 'plugins', {\n      get: () => [1, 2, 3, 4, 5],\n    });\n    \u002F\u002F Override navigator.languages\n    Object.defineProperty(navigator, 'languages', {\n      get: () => ['en-US', 'en'],\n    });\n    \u002F\u002F Override chrome.runtime to avoid detection\n    window.chrome = { runtime: {} };\n  });\n  const page = await context.newPage();\n  await page.goto('https:\u002F\u002Fbot.sannysoft.com\u002F');\n  await page.screenshot({ path: 'stealth-test.png' });\n  await browser.close();\n})();\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Python 隐形配置\u003C\u002Fh3>\u003Cpre>\u003Ccode>from playwright.sync_api import sync_playwright\nwith sync_playwright() as p:\n    browser = p.chromium.launch(\n        args=[\n            \"--disable-blink-features=AutomationControlled\",\n        ]\n    )\n    context = browser.new_context(\n        proxy={\n            \"server\": \"http:\u002F\u002Fgate.proxyhat.com:8080\",\n            \"username\": \"USERNAME\",\n            \"password\": \"PASSWORD\",\n        },\n        user_agent=\"Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) \"\n                   \"AppleWebKit\u002F537.36 (KHTML, like Gecko) \"\n                   \"Chrome\u002F131.0.0.0 Safari\u002F537.36\",\n        viewport={\"width\": 1920, \"height\": 1080},\n        locale=\"en-US\",\n        timezone_id=\"America\u002FNew_York\",\n    )\n    context.add_init_script(\"\"\"\n        Object.defineProperty(navigator, 'webdriver', {\n            get: () => undefined,\n        });\n        window.chrome = { runtime: {} };\n    \"\"\")\n    page = context.new_page()\n    page.goto(\"https:\u002F\u002Fhttpbin.org\u002Fheaders\")\n    print(page.text_content(\"body\"))\n    browser.close()\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>用代理旋转重试逻辑\u003C\u002Fh2>\u003Cp>将重试逻辑与自动代理旋转相结合,可确保以新鲜的IP和上下文重试失败的请求.\u003C\u002Fp>\u003Cpre>\u003Ccode>const { chromium } = require('playwright');\nconst crypto = require('crypto');\nasync function fetchWithRetry(browser, url, maxRetries = 3) {\n  for (let attempt = 1; attempt \u003C= maxRetries; attempt++) {\n    const sessionId = crypto.randomBytes(4).toString('hex');\n    const context = await browser.newContext({\n      proxy: {\n        server: 'http:\u002F\u002Fgate.proxyhat.com:8080',\n        username: `USERNAME-sid-${sessionId}`,\n        password: 'PASSWORD',\n      },\n    });\n    const page = await context.newPage();\n    try {\n      const response = await page.goto(url, {\n        timeout: 30000,\n        waitUntil: 'domcontentloaded',\n      });\n      if (response && response.status() >= 400) {\n        console.log(`Attempt ${attempt}: HTTP ${response.status()}, retrying...`);\n        await context.close();\n        continue;\n      }\n      const html = await page.content();\n      await context.close();\n      return html;\n    } catch (err) {\n      console.log(`Attempt ${attempt} failed: ${err.message}`);\n      await context.close();\n      if (attempt === maxRetries) {\n        throw new Error(`All ${maxRetries} attempts failed for ${url}`);\n      }\n      \u002F\u002F Exponential backoff\n      await new Promise(r => setTimeout(r, 1000 * Math.pow(2, attempt - 1)));\n    }\n  }\n}\n(async () => {\n  const browser = await chromium.launch();\n  try {\n    const html = await fetchWithRetry(browser, 'https:\u002F\u002Fexample.com\u002Fdata');\n    console.log(`Fetched ${html.length} chars`);\n  } catch (err) {\n    console.error(err.message);\n  }\n  await browser.close();\n})();\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>SOCKS5 与 Playwright 的代理服务器\u003C\u002Fh2>\u003Cp>代理Hat还支持1080端口的SOCKS5. 当您需要协议不可知代理时, 或想要避免 HTTP CONNECT 管理时, 这样做是有用的 。\u003C\u002Fp>\u003Cpre>\u003Ccode>const { chromium } = require('playwright');\n(async () => {\n  const browser = await chromium.launch({\n    proxy: {\n      server: 'socks5:\u002F\u002Fgate.proxyhat.com:1080',\n      username: 'USERNAME',\n      password: 'PASSWORD',\n    },\n  });\n  const page = await browser.newPage();\n  await page.goto('https:\u002F\u002Fhttpbin.org\u002Fip');\n  console.log(await page.textContent('body'));\n  await browser.close();\n})();\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>生产涂鸦模式\u003C\u002Fh2>\u003Cp>这里有一个完整的生产准备的刮纸机,它结合了以上所有模式——按照文本代理旋转,隐形设置,重试逻辑,货币,以及结构化的数据提取.\u003C\u002Fp>\u003Cpre>\u003Ccode>const { chromium } = require('playwright');\nconst crypto = require('crypto');\nconst fs = require('fs');\nclass PlaywrightScraper {\n  constructor({ concurrency = 3, maxRetries = 3 }) {\n    this.concurrency = concurrency;\n    this.maxRetries = maxRetries;\n    this.browser = null;\n    this.results = [];\n    this.stats = { success: 0, failed: 0 };\n  }\n  async init() {\n    this.browser = await chromium.launch({\n      args: ['--disable-blink-features=AutomationControlled'],\n    });\n  }\n  _createContext() {\n    const sessionId = crypto.randomBytes(4).toString('hex');\n    return this.browser.newContext({\n      proxy: {\n        server: 'http:\u002F\u002Fgate.proxyhat.com:8080',\n        username: `USERNAME-sid-${sessionId}`,\n        password: 'PASSWORD',\n      },\n      userAgent: 'Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\u002F537.36 (KHTML, like Gecko) Chrome\u002F131.0.0.0 Safari\u002F537.36',\n      viewport: { width: 1920, height: 1080 },\n      locale: 'en-US',\n    });\n  }\n  async scrapePage(url) {\n    for (let attempt = 1; attempt \u003C= this.maxRetries; attempt++) {\n      const context = await this._createContext();\n      const page = await context.newPage();\n      try {\n        const response = await page.goto(url, {\n          timeout: 30000,\n          waitUntil: 'networkidle',\n        });\n        if (!response || response.status() >= 400) {\n          await context.close();\n          continue;\n        }\n        \u002F\u002F Extract data — customize this for your target\n        const data = await page.evaluate(() => ({\n          title: document.title,\n          text: document.body.innerText.substring(0, 500),\n        }));\n        await context.close();\n        this.stats.success++;\n        return { url, ...data, success: true };\n      } catch (err) {\n        await context.close();\n        if (attempt === this.maxRetries) {\n          this.stats.failed++;\n          return { url, error: err.message, success: false };\n        }\n        await new Promise(r => setTimeout(r, 1000 * attempt));\n      }\n    }\n  }\n  async scrapeAll(urls) {\n    await this.init();\n    for (let i = 0; i \u003C urls.length; i += this.concurrency) {\n      const batch = urls.slice(i, i + this.concurrency);\n      const batchResults = await Promise.all(\n        batch.map(url => this.scrapePage(url))\n      );\n      this.results.push(...batchResults);\n    }\n    await this.browser.close();\n    console.log(`Done: ${this.stats.success} OK, ${this.stats.failed} failed`);\n    return this.results;\n  }\n}\n\u002F\u002F Usage\nconst scraper = new PlaywrightScraper({ concurrency: 5, maxRetries: 3 });\nconst urls = Array.from({ length: 50 }, (_, i) =>\n  `https:\u002F\u002Fexample.com\u002Fitem\u002F${i + 1}`\n);\nscraper.scrapeAll(urls).then(results => {\n  fs.writeFileSync('results.json', JSON.stringify(results, null, 2));\n});\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>关于构建可重复使用的代理抽象层,请参见 \u003Ca href=\"\u002Fcn\u002Fblog\u002Fdaili-zhongjian-jian-ceng\">构建代理软件中层\u003C\u002Fa>。探索 \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fnode-sdk\">节点 SDK\u003C\u002Fa> 和 \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FProxyHatCom\u002Fpython-sdk\">Python SDK 键盘\u003C\u002Fa> 用于简化代理管理,并检查 \u003Ca href=\"\u002Fcn\u002Fpricing\">代理用户定价\u003C\u002Fa> 开始吧\u003C\u002Fp>","Playwright轮换代理完整开发者指南","在Playwright中集成轮换代理的完整指南。学习代理配置、浏览器上下文管理、并发爬取和反检测设置的代码示例和生产环境最佳实践。","\u002Fcn\u002Fblog\u002Fplaywright-lunhuan-daili",null,"https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fplaywright-lunhuan-daili-og.webp",[17,20,23,26,29],{"question":18,"answer":19},"如何在Playwright中设置代理？","在浏览器启动时通过proxy选项配置：browser = await playwright.chromium.launch({proxy: {server: \"http:\u002F\u002Fgate.proxyhat.com:8080\", username: \"user\", password: \"pass\"}})。也可以在创建新的浏览器上下文时单独设置代理，实现每个上下文使用不同的代理。",{"question":21,"answer":22},"Playwright中如何实现每个请求使用不同的代理IP？","使用ProxyHat的轮换网关地址gate.proxyhat.com:8080，每个新连接会自动分配不同的IP。或者为每个页面创建新的浏览器上下文，每个上下文可以设置不同的代理服务器。通过上下文隔离实现请求级别的IP轮换。",{"question":24,"answer":25},"Playwright比Puppeteer配合代理使用有什么优势？","Playwright原生支持多种浏览器（Chromium、Firefox、WebKit），内置代理认证支持（无需page.authenticate()），提供更好的上下文隔离（每个上下文独立的代理、cookie和存储），以及更可靠的自动等待机制。对于需要跨浏览器测试的爬取任务尤其有优势。",{"question":27,"answer":28},"如何在Playwright中进行并发代理爬取？","创建多个浏览器上下文或页面，每个使用不同的代理配置。使用Promise.all()或asyncio.gather()并行执行多个页面操作。控制并发数量（通常5-15个同时页面）以平衡速度和资源使用。确保正确关闭完成的页面和上下文以释放内存。",{"question":30,"answer":31},"Playwright配合代理时如何避免被检测？","使用playwright-stealth或playwright-extra来隐藏自动化特征。设置真实的viewport大小和User-Agent，启用JavaScript和图片加载，模拟鼠标移动和滚动行为。使用住宅代理而非数据中心代理，并确保每个上下文的浏览器指纹唯一且一致。",[33,34,35,36,37],"Playwright支持浏览器级、上下文级和页面级代理配置，其中按上下文轮换代理是推荐模式，可避免为每个IP启动新浏览器。","可将代理的地理定位与Playwright的locale和timezone设置结合，以最大化抓取本地化内容时的真实性。","通过添加隐形配置（如覆盖navigator.webdriver）和重试逻辑，能有效绕过反机器人系统并确保失败请求用新IP重试。","Playwright支持在端口1080使用SOCKS5代理，适用于需要协议无关代理的场景。","结合并发工作池、代理轮换和隐形设置的生产级爬虫能大幅提高数据抓取吞吐量和成功率。",false,"2026-01-25T07:37:52+00:00","2026-07-19T03:13:07+00:00","2026-10-03T08:21:34+00:00","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fplaywright-lunhuan-daili-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fplaywright-lunhuan-daili-card.webp",11,{"name":46,"slug":47,"bio":48,"avatar_url":14,"website_url":14,"social_links":14},"ProxyHat Team","proxyhat-team","The ProxyHat editorial team covers proxies, web scraping, and data extraction.",[50],{"id":51,"slug":52,"name":53,"description":14,"meta_title":54,"meta_description":55,"parent_id":14},4,"kaifa-zhinan","开发者指南","开发者指南 | ProxyHat 博客","代码教程和SDK指南，帮助您将代理集成到应用程序中。",[57,61,65],{"id":58,"slug":59,"name":60},1,"web-scraping","网页抓取",{"id":62,"slug":63,"name":64},12,"sdk","SDK",{"id":6,"slug":66,"name":67},"playwright","Playwright",{"ru":69,"en":70,"fr":71,"ja":72,"x-default":70},"\u002Fru\u002Fblog\u002Frotatsiya-proksi-s-playwright","\u002Fblog\u002Frotating-proxies-with-playwright","\u002Ffr\u002Fblog\u002Fproxies-rotatifs-avec-playwright","\u002Fja\u002Fblog\u002Fplaywright-de-prokishi-rooteshon",{"ko":74,"ru":69,"it":75,"en":70,"de":76,"tr":77,"fr":71,"zh":13,"es":78,"pt":79,"ja":72,"pl":80},"\u002Fko\u002Fblog\u002Fplaywright-rotating-proxy-gaideu","\u002Fit\u002Fblog\u002Fproxies-rotanti-con-playwright-guida-completa-degli-sviluppatori","\u002Fde\u002Fblog\u002Frotierende-proxies-mit-playwright","\u002Ftr\u002Fblog\u002Fplaywright-ile-donen-proxyler","\u002Fes\u002Fblog\u002Fproxies-rotativos-con-playwright","\u002Fpt\u002Fblog\u002Fproxies-rotativos-com-playwright","\u002Fpl\u002Fblog\u002Frotacyjne-wyniki-z-playwright-kompletny-przewodnik-programisty",382,[83,111,128,145],{"id":84,"slug":85,"title":86,"excerpt":87,"featured_image_url":88,"featured_image_alt":89,"card_image_url":90,"og_image_url":91,"published_at":92,"updated_at":93,"content_updated_at":94,"reading_time_minutes":95,"is_featured":38,"indexable":4,"views":96,"author":97,"categories":98,"tags":100},210,"ai-agent-daili-peizhi","AI Agent 代理配置：browser-use、Crawl4AI、MCP","运行在云服务器上的智能体从数据中心 IP 出口。本文给出 browser-use、Crawl4AI 和 MCP 服务器当前可用的代理配置，附粘性与轮换的决策表，以及需要避开的成本陷阱。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fai-agent-daili-peizhi-master.webp","Proxy Setup for AI Agents: browser-use, Crawl4AI and an MCP Server","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fai-agent-daili-peizhi-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fai-agent-daili-peizhi-og.webp","2026-10-24T09:00:00+00:00","2026-10-24T09:00:20+00:00","2026-10-03T09:41:40+00:00",14,39,{"name":46,"slug":47,"bio":48,"avatar_url":14,"website_url":14,"social_links":14},[99],{"id":51,"slug":52,"name":53,"description":14,"meta_title":54,"meta_description":55,"parent_id":14},[101,102,106,110],{"id":58,"slug":59,"name":60},{"id":103,"slug":104,"name":105},2,"residential-proxies","住宅代理",{"id":107,"slug":108,"name":109},9,"python","Python",{"id":6,"slug":66,"name":67},{"id":112,"slug":113,"title":114,"excerpt":115,"featured_image_url":116,"featured_image_alt":14,"card_image_url":117,"og_image_url":118,"published_at":119,"updated_at":40,"content_updated_at":120,"reading_time_minutes":62,"is_featured":38,"indexable":38,"views":121,"author":122,"categories":123,"tags":125},50,"sheji-kekaode-caiji-jiagou","设计可靠的网络爬虫架构","设计端到端的刮刮系统:排程器,URL队列,爬行器池,代理层,剖析器,存储,以及监控. 生产准备的 Python 代码与建筑图.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fsheji-kekaode-caiji-jiagou-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fsheji-kekaode-caiji-jiagou-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fsheji-kekaode-caiji-jiagou-og.webp","2026-02-24T06:55:16+00:00","2026-10-03T08:21:25+00:00",73,{"name":46,"slug":47,"bio":48,"avatar_url":14,"website_url":14,"social_links":14},[124],{"id":51,"slug":52,"name":53,"description":14,"meta_title":54,"meta_description":55,"parent_id":14},[126,127],{"id":62,"slug":63,"name":64},{"id":58,"slug":59,"name":60},{"id":129,"slug":130,"title":131,"excerpt":132,"featured_image_url":133,"featured_image_alt":14,"card_image_url":134,"og_image_url":135,"published_at":136,"updated_at":40,"content_updated_at":137,"reading_time_minutes":44,"is_featured":38,"indexable":38,"views":138,"author":139,"categories":140,"tags":142},41,"jiankong-daili-xingneng","监控代理性能：延迟、成功率和告警","学习如何对代理性能进行仪表、监控和警报——跟踪延迟百分位数、成功率、错误模式和带宽。 Python、Node.js和Go的代码示例.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fjiankong-daili-xingneng-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fjiankong-daili-xingneng-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fjiankong-daili-xingneng-og.webp","2026-02-15T00:39:23+00:00","2026-10-03T08:21:24+00:00",77,{"name":46,"slug":47,"bio":48,"avatar_url":14,"website_url":14,"social_links":14},[141],{"id":51,"slug":52,"name":53,"description":14,"meta_title":54,"meta_description":55,"parent_id":14},[143,144],{"id":62,"slug":63,"name":64},{"id":58,"slug":59,"name":60},{"id":146,"slug":147,"title":148,"excerpt":149,"featured_image_url":150,"featured_image_alt":14,"card_image_url":151,"og_image_url":152,"published_at":153,"updated_at":40,"content_updated_at":154,"reading_time_minutes":155,"is_featured":38,"indexable":38,"views":112,"author":156,"categories":157,"tags":161},36,"kuozhan-caiji-jiagou","如何扩展网络爬虫基础设施","缩放网刮的架构模式:基于队列的系统,管道设计,带容器的横向缩放,以及规模化的代理管理. 代码在Python,Node.js,和去.","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fkuozhan-caiji-jiagou-master.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fkuozhan-caiji-jiagou-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog\u002Fkuozhan-caiji-jiagou-og.webp","2026-02-09T14:42:34+00:00","2026-02-26T00:33:08+00:00",10,{"name":46,"slug":47,"bio":48,"avatar_url":14,"website_url":14,"social_links":14},[158],{"id":58,"slug":59,"name":60,"description":14,"meta_title":159,"meta_description":160,"parent_id":14},"网页抓取指南 | ProxyHat 博客","网页抓取技术、代理策略和数据提取最佳实践。",[162,163],{"id":58,"slug":59,"name":60},{"id":62,"slug":63,"name":64},[]]