[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-cn-python-google-paiming-zhuizong":3},{"success":4,"payload":5,"related":62,"errors":128},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":11,"og_description":12,"og_image_url":15,"faq_json":16,"key_takeaways":23,"allow_index":29,"noindex_google_only":29,"allow_follow":4,"published_at":30,"updated_at":30,"content_updated_at":31,"featured_image_url":32,"featured_image_alt":33,"card_image_url":34,"reading_time_minutes":35,"author":36,"categories":40,"tags":47,"alternates":48,"locale_paths":60,"views":61},152,"python-google-paiming-zhuizong","使用住宅代理在Python中构建Google排名追踪器：完整代码指南","本指南面向SEO工程师和Python开发者，演示如何用curl_cffi和ProxyHat住宅代理构建生产级Google排名追踪器，涵盖数据模型、SERP分页抓取、TLS指纹规避、重试策略与并发控制。","\u003Cp>如果你需要大规模追踪关键词排名，手动查询Google既不可靠也不可扩展。本文将教你使用住宅代理在Python中构建Google排名追踪器，从数据模型到生产级加固，提供完整可运行的代码示例。\u003C\u002Fp>\n\n\u003Ch2>为什么使用住宅代理在Python中构建Google排名追踪器至关重要\u003C\u002Fh2>\n\n\u003Cp>Google的搜索结果页（SERP）会根据用户IP、设备、语言和地理位置动态变化。当你用同一个数据中心IP反复查询相同关键词时，Google的反爬系统会在几十次请求后触发CAPTCHA或返回空结果。根据\u003Ca href=\"https:\u002F\u002Fdevelopers.google.com\u002Fsearch\u002Fdocs\" rel=\"noopener noreferrer\">Google Search Central文档\u003C\u002Fa>，Google明确限制自动化抓取行为，其反爬机制包括TLS指纹检测（JA3\u002FJA4）、IP信誉评分和行为分析。\u003C\u002Fp>\n\n\u003Cp>住宅代理通过真实ISP分配的IP地址发送请求，使流量看起来来自普通家庭用户。结合城市级地理定位和粘性会话，你可以模拟不同地区的真实搜索行为，大幅降低被封锁的概率。\u003C\u002Fp>\n\n\u003Ch2>数据模型设计：为什么每日SERP快照优于一次性检查\u003C\u002Fh2>\n\n\u003Cp>排名是动态的——同一天上午和下午的排名可能不同。一次性检查只能给你一个时间点的快照，而每日定时抓取能揭示排名趋势、波动模式和算法更新的影响。\u003C\u002Fp>\n\n\u003Cp>核心数据模型如下：\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>关键词(keyword) | 目标域名(target_domain) | 国家(country)\n设备(device) | 排名位置(position) | 抓取时间(captured_at)\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Cp>用SQLite存储历史数据，既能支持趋势分析，又无需额外数据库服务。下面是建表和插入的代码：\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>import sqlite3\nfrom datetime import datetime\n\ndef init_db(db_path=&quot;rank_tracker.db&quot;):\n    conn = sqlite3.connect(db_path)\n    conn.execute(&quot;&quot;&quot;\n        CREATE TABLE IF NOT EXISTS rankings (\n            id INTEGER PRIMARY KEY AUTOINCREMENT,\n            keyword TEXT NOT NULL,\n            target_domain TEXT NOT NULL,\n            country TEXT NOT NULL DEFAULT &apos;US&apos;,\n            device TEXT NOT NULL DEFAULT &apos;desktop&apos;,\n            position INTEGER,\n            result_url TEXT,\n            captured_at TEXT NOT NULL,\n            UNIQUE(keyword, target_domain, country, device, captured_at)\n        )\n    &quot;&quot;&quot;)\n    conn.execute(\n        &quot;CREATE INDEX IF NOT EXISTS idx_keyword_date &quot;\n        &quot;ON rankings(keyword, captured_at)&quot;\n    )\n    conn.commit()\n    return conn\n\ndef save_ranking(conn, keyword, target_domain, country, device, position, result_url):\n    conn.execute(\n        &quot;&quot;&quot;INSERT OR REPLACE INTO rankings\n           (keyword, target_domain, country, device, position, result_url, captured_at)\n           VALUES (?, ?, ?, ?, ?, ?, ?)&quot;&quot;&quot;,\n        (keyword, target_domain, country, device, position, result_url, datetime.utcnow().isoformat())\n    )\n    conn.commit()\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>Google移除num=100后的SERP分页策略\u003C\u002Fh2>\n\n\u003Cp>2025年9月，Google正式移除了\u003Ccode>num=100\u003C\u002Fcode>参数，这意味着你无法再通过单次请求获取100条结果。现在每页最多返回10条自然结果，需要通过\u003Ccode>start=0,10,20...90\u003C\u002Fcode>参数分页抓取前100条结果。\u003C\u002Fp>\n\n\u003Cp>分页抓取时需注意：\u003C\u002Fp>\n\u003Cul>\n\u003Cli>每页之间添加随机延迟（2-5秒），避免触发频率限制\u003C\u002Fli>\n\u003Cli>跳过广告（\u003Ccode> sponsored\u003C\u002Fcode>标签）和SERP特性（知识面板、People Also Ask等）\u003C\u002Fli>\n\u003Cli>只解析\u003Ccode>div.g\u003C\u002Fcode>中的自然结果\u003C\u002Fli>\n\u003Cli>记录每页实际返回的结果数，如果某页返回0条则提前终止\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Ch2>为什么必须使用住宅代理：TLS指纹与IP信誉\u003C\u002Fh2>\n\n\u003Cp>Google使用多种技术检测自动化流量：\u003C\u002Fp>\n\n\u003Ctable>\n\u003Cthead>\n\u003Ctr>\u003Cth>检测维度\u003C\u002Fth>\u003Cth>数据中心代理\u003C\u002Fth>\u003Cth>住宅代理\u003C\u002Fth>\u003C\u002Ftr>\n\u003C\u002Fthead>\n\u003Ctbody>\n\u003Ctr>\u003Ctd>TLS\u002FJA3-JA4指纹\u003C\u002Ftd>\u003Ctd>需curl_cffi模拟\u003C\u002Ftd>\u003Ctd>需curl_cffi模拟\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>IP信誉评分\u003C\u002Ftd>\u003Ctd>低——容易被标记\u003C\u002Ftd>\u003Ctd>高——真实ISP分配\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>地理定位精度\u003C\u002Ftd>\u003Ctd>通常仅国家级\u003C\u002Ftd>\u003Ctd>城市级（如芝加哥）\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>会话保持\u003C\u002Ftd>\u003Ctd>有限支持\u003C\u002Ftd>\u003Ctd>支持粘性会话\u003C\u002Ftd>\u003C\u002Ftr>\n\u003Ctr>\u003Ctd>被封锁概率\u003C\u002Ftd>\u003Ctd>高（约50%以上请求可能被拦截）\u003C\u002Ftd>\u003Ctd>低（成功率达99%以上）\u003C\u002Ftd>\u003C\u002Ftr>\n\u003C\u002Ftbody>\n\u003C\u002Ftable>\n\n\u003Cp>即使使用住宅代理，你仍需用\u003Ccode>curl_cffi\u003C\u002Fcode>的\u003Ccode>impersonate='chrome'\u003C\u002Fcode>参数模拟真实浏览器的TLS指纹。根据\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Flexiforest\u002Fcurl_cffi\" rel=\"noopener noreferrer\">curl_cffi项目文档\u003C\u002Fa>，该库通过编译版libcurl支持JA3\u002FJA4指纹伪装，这是普通\u003Ccode>requests\u003C\u002Fcode>库无法做到的。\u003C\u002Fp>\n\n\u003Ch2>实战：curl_cffi + ProxyHat住宅代理抓取SERP\u003C\u002Fh2>\n\n\u003Ch3>基础配置\u003C\u002Fh3>\n\n\u003Cp>ProxyHat的住宅代理通过\u003Ccode>gate.proxyhat.com:8080\u003C\u002Fcode>网关接入，用户名中可指定国家、城市和会话ID。以下是Python示例：\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>from curl_cffi import requests as cffi_requests\nimport hashlib\n\ndef build_proxy_url(keyword, country=&quot;US&quot;, region=&quot;illinois&quot;, city=&quot;chicago&quot;):\n    &quot;&quot;&quot;根据关键词生成粘性会话ID，确保同一关键词始终使用同一出口IP&quot;&quot;&quot;\n    session_id = hashlib.md5(keyword.encode()).hexdigest()[:12]\n    username = f&quot;user-country-{country}-region-{region}-city-{city}-sid-{session_id}&quot;\n    password = &quot;YOUR_PASSWORD&quot;\n    return f&quot;http:\u002F\u002F{username}:{password}@gate.proxyhat.com:8080&quot;\n\n# 单次SERP请求示例\ndef fetch_serp(keyword, country=&quot;US&quot;, region=&quot;illinois&quot;, city=&quot;chicago&quot;, start=0):\n    proxy = build_proxy_url(keyword, country, region, city)\n    url = &quot;https:\u002F\u002Fwww.google.com\u002Fsearch&quot;\n    params = {\n        &quot;q&quot;: keyword,\n        &quot;num&quot;: 10,\n        &quot;start&quot;: start,\n        &quot;hl&quot;: &quot;en&quot;,\n        &quot;gl&quot;: country.lower(),\n    }\n    headers = {\n        &quot;User-Agent&quot;: (\n            &quot;Mozilla\u002F5.0 (Windows NT 10.0; Win64; x64) &quot;\n            &quot;AppleWebKit\u002F537.36 (KHTML, like Gecko) &quot;\n            &quot;Chrome\u002F131.0.0.0 Safari\u002F537.36&quot;\n        ),\n        &quot;Accept-Language&quot;: &quot;en-US,en;q=0.9&quot;,\n    }\n    resp = cffi_requests.get(\n        url, params=params, headers=headers,\n        proxies={&quot;http&quot;: proxy, &quot;https&quot;: proxy},\n        impersonate=&quot;chrome&quot;,\n        timeout=30,\n    )\n    resp.raise_for_status()\n    return resp.text\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch3>使用ProxyHat SDK简化代理管理\u003C\u002Fh3>\n\n\u003Cp>如果你需要更灵活的IP轮换策略，可以结合ProxyHat SDK管理会话池：\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>import itertools\nfrom curl_cffi import requests as cffi_requests\n\nclass ProxyHatSERPClient:\n    def __init__(self, username, password, countries=None):\n        self.base_user = username\n        self.password = password\n        self.countries = countries or [&quot;US&quot;, &quot;DE&quot;, &quot;GB&quot;]\n        self._country_cycle = itertools.cycle(self.countries)\n\n    def get_proxy(self, keyword, country=None, city=None, sticky=True):\n        c = country or next(self._country_cycle)\n        parts = [f&quot;user-country-{c}&quot;]\n        if city:\n            parts.append(f&quot;city-{city}&quot;)\n        if sticky:\n            import hashlib\n            sid = hashlib.md5(keyword.encode()).hexdigest()[:12]\n            parts.append(f&quot;sid-{sid}&quot;)\n        username = &quot;-&quot;.join(parts)\n        return {\n            &quot;http&quot;: f&quot;http:\u002F\u002F{username}:{self.password}@gate.proxyhat.com:8080&quot;,\n            &quot;https&quot;: f&quot;http:\u002F\u002F{username}:{self.password}@gate.proxyhat.com:8080&quot;,\n        }\n\n    def search(self, keyword, start=0, country=None, city=None):\n        proxy = self.get_proxy(keyword, country, city)\n        resp = cffi_requests.get(\n            &quot;https:\u002F\u002Fwww.google.com\u002Fsearch&quot;,\n            params={&quot;q&quot;: keyword, &quot;num&quot;: 10, &quot;start&quot;: start, &quot;hl&quot;: &quot;en&quot;},\n            proxies=proxy,\n            impersonate=&quot;chrome&quot;,\n            timeout=30,\n        )\n        resp.raise_for_status()\n        return resp.text\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>解析排名位置：CSS选择器与正则结合\u003C\u002Fh2>\n\n\u003Cp>Google的HTML结构经常变化，不能完全依赖单一选择器。建议用\u003Ccode>selectolax\u003C\u002Fcode>或\u003Ccode>BeautifulSoup\u003C\u002Fcode>解析，同时准备正则作为后备：\u003C\u002Fp>\n\n\u003Cpre>\u003Ccode>from selectolax.parser import HTMLParser\nfrom urllib.parse import urlparse\nimport re\n\ndef parse_organic_results(html, target_domain):\n    &quot;&quot;&quot;解析SERP中的自然结果，返回目标域名的排名位置&quot;&quot;&quot;\n    tree = HTMLParser(html)\n    results = []\n    position = 0\n\n    # 主要选择器：div.g &gt; div &gt; div a[href] — Google自然结果容器\n    for node in tree.css(&quot;div.g&quot;):\n        link = node.css_first(&quot;a[href]&quot;)\n        if not link:\n            continue\n        href = link.attributes.get(&quot;href&quot;, &quot;&quot;)\n        if not href.startswith(&quot;http&quot;):\n            continue\n\n        # 跳过广告\n        parent_text = node.text(separator=&quot; &quot;).lower()\n        if &quot;sponsored&quot; in parent_text:\n            continue\n\n        position += 1\n        host = urlparse(href).netloc\n        results.append({&quot;position&quot;: position, &quot;url&quot;: href, &quot;host&quot;: host})\n\n    # 查找目标域名\n    target_rank = None\n    target_url = None\n    for r in results:\n        if target_domain in r[&quot;host&quot;]:\n            target_rank = r[&quot;position&quot;]\n            target_url = r[&quot;url&quot;]\n            break\n\n    # 后备正则匹配（当CSS选择器失效时）\n    if target_rank is None:\n        pattern = re.compile(rf&apos;href=&quot;(https?:\u002F\u002F[^&quot;&apos;]*{re.escape(target_domain)}[^&quot;&apos;]*)&quot;&apos;, re.I)\n        for i, match in enumerate(pattern.finditer(html), 1):\n            target_rank = i\n            target_url = match.group(1)\n            break\n\n    return target_rank, target_url, results\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>分页抓取前100条结果\u003C\u002Fh2>\n\n\u003Cpre>\u003Ccode>import time\nimport random\n\ndef track_keyword(conn, keyword, target_domain, country=&quot;US&quot;, city=&quot;chicago&quot;, max_pages=10):\n    &quot;&quot;&quot;分页抓取前100条结果，记录目标域名排名&quot;&quot;&quot;\n    rank_found = None\n    found_url = None\n\n    for page in range(max_pages):\n        start = page * 10\n        try:\n            html = fetch_serp(keyword, country, city, start=start)\n        except Exception as e:\n            print(f&quot;[ERROR] Page {page} failed: {e}&quot;)\n            continue\n\n        rank, url, results = parse_organic_results(html, target_domain)\n\n        # 如果本页找到目标，记录并退出\n        if rank is not None:\n            # 加上前面页面的偏移量\n            rank_found = rank + start\n            found_url = url\n            break\n\n        # 如果本页无自然结果，提前终止\n        if len(results) == 0:\n            print(f&quot;[INFO] No results on page {page}, stopping pagination&quot;)\n            break\n\n        # 随机延迟2-5秒\n        time.sleep(random.uniform(2, 5))\n\n    save_ranking(\n        conn, keyword, target_domain, country, &quot;desktop&quot;,\n        rank_found or 101,  # 101表示未找到\n        found_url or &quot;&quot;,\n    )\n    return rank_found\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>生产级加固：重试、CAPTCHA检测与并发控制\u003C\u002Fh2>\n\n\u003Ch3>指数退避重试\u003C\u002Fh3>\n\n\u003Cpre>\u003Ccode>import logging\nfrom tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type\n\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\n@retry(\n    stop=stop_after_attempt(3),\n    wait=wait_exponential(multiplier=1, min=2, max=30),\n    retry=retry_if_exception_type((ConnectionError, TimeoutError)),\n    before_sleep=lambda retry_state: logger.info(\n        f&quot;Retrying in {retry_state.next_action.sleep:.0f}s (attempt {retry_state.attempt_number})&quot;\n    ),\n)\ndef fetch_serp_with_retry(keyword, country=&quot;US&quot;, city=&quot;chicago&quot;, start=0):\n    html = fetch_serp(keyword, country, city, start=start)\n    # CAPTCHA检测\n    captcha_markers = [&quot;unusual traffic&quot;, &quot;captcha&quot;, &quot;detected unusual traffic&quot;]\n    lower_html = html.lower()\n    if any(marker in lower_html for marker in captcha_markers):\n        raise RuntimeError(&quot;CAPTCHA detected — switching session recommended&quot;)\n    return html\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch3>并发控制与每国家代理池\u003C\u002Fh3>\n\n\u003Cpre>\u003Ccode>import asyncio\nimport aiofiles\nimport csv\nfrom asyncio import Semaphore\n\nasync def track_batch(keywords, target_domain, countries, max_concurrent=5):\n    &quot;&quot;&quot;并发追踪多个关键词，每国家独立并发限制&quot;&quot;&quot;\n    sem = Semaphore(max_concurrent)\n    conn = init_db()\n\n    async def track_one(keyword, country, city):\n        async with sem:\n            try:\n                rank = track_keyword(conn, keyword, target_domain, country, city)\n                logger.info(f&quot;{keyword} | {country} → position {rank}&quot;)\n                return rank\n            except Exception as e:\n                logger.error(f&quot;Failed: {keyword} ({country}): {e}&quot;)\n                return None\n\n    tasks = []\n    for kw in keywords:\n        for country in countries:\n            city = &quot;chicago&quot; if country == &quot;US&quot; else None\n            tasks.append(track_one(kw, country, city))\n\n    await asyncio.gather(*tasks)\n    conn.close()\n\n# 运行示例\nif __name__ == &quot;__main__&quot;:\n    keywords = [&quot;best running shoes&quot;, &quot;marathon training plan&quot;, &quot;carbon plate shoes&quot;]\n    countries = [&quot;US&quot;, &quot;DE&quot;, &quot;GB&quot;]\n    asyncio.run(track_batch(keywords, &quot;example.com&quot;, countries, max_concurrent=5))\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch3>CSV导出与历史趋势分析\u003C\u002Fh3>\n\n\u003Cpre>\u003Ccode>def export_to_csv(conn, output_path=&quot;rankings_export.csv&quot;):\n    rows = conn.execute(\n        &quot;SELECT keyword, target_domain, country, device, position, captured_at &quot;\n        &quot;FROM rankings ORDER BY keyword, captured_at&quot;\n    ).fetchall()\n    with open(output_path, &quot;w&quot;, newline=&quot;&quot;, encoding=&quot;utf-8&quot;) as f:\n        writer = csv.writer(f)\n        writer.writerow([&quot;keyword&quot;, &quot;target_domain&quot;, &quot;country&quot;, &quot;device&quot;, &quot;position&quot;, &quot;captured_at&quot;])\n        writer.writerows(rows)\n    logger.info(f&quot;Exported {len(rows)} rows to {output_path}&quot;)\n\ndef rank_volatility(conn, keyword, days=7):\n    &quot;&quot;&quot;计算最近N天的排名波动（标准差）&quot;&quot;&quot;\n    rows = conn.execute(\n        &quot;SELECT position FROM rankings WHERE keyword=? ORDER BY captured_at DESC LIMIT ?&quot;,\n        (keyword, days)\n    ).fetchall()\n    positions = [r[0] for r in rows if r[0] and r[0] &lt;= 100]\n    if len(positions) &lt; 2:\n        return 0.0\n    avg = sum(positions) \u002F len(positions)\n    variance = sum((p - avg) ** 2 for p in positions) \u002F len(positions)\n    return variance ** 0.5\u003C\u002Fcode>\u003C\u002Fpre>\n\n\u003Ch2>伦理与限制：合规使用排名追踪器\u003C\u002Fh2>\n\n\u003Cp>构建排名追踪器时需遵守以下原则：\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>优先使用官方API\u003C\u002Fstrong>：如果你的查询量较低（每天&lt;100次），建议使用\u003Ca href=\"https:\u002F\u002Fdevelopers.google.com\u002Fcustom-search\u002Fv1\u002Foverview\" rel=\"noopener noreferrer\">Google Custom Search API\u003C\u002Fa>或官方SERP API，合规且稳定\u003C\u002Fli>\n\u003Cli>\u003Cstrong>遵守robots.txt\u003C\u002Fstrong>：虽然Google的robots.txt允许\u002F搜索路径，但应尊重其爬取频率限制\u003C\u002Fli>\n\u003Cli>\u003Cstrong>仅追踪公开数据\u003C\u002Fstrong>：不要追踪需要登录才能访问的内容，不要存储个人数据\u003C\u002Fli>\n\u003Cli>\u003Cstrong>控制请求频率\u003C\u002Fstrong>：单关键词每日1-2次足够，无需高频查询\u003C\u002Fli>\n\u003Cli>\u003Cstrong>GDPR\u002FCCPA合规\u003C\u002Fstrong>：如果你的数据涉及欧盟或加州用户，确保数据存储符合相关法规\u003C\u002Fli>\n\u003C\u002Ful>\n\n\u003Cblockquote>\n\u003Cp>关键提醒：排名追踪器应用于监控你自己拥有的域名排名，或进行合法的竞争分析。未经授权的大规模SERP抓取可能违反Google服务条款。\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\n\u003Cp>准备好开始构建你自己的排名追踪器了吗？查看ProxyHat的\u003Ca href=\"\u002Fcn\u002Fpricing\">定价方案\u003C\u002Fa>和\u003Ca href=\"\u002Fcn\u002Flocations\">代理位置列表\u003C\u002Fa>，或了解更多\u003Ca href=\"\u002Fcn\u002Fuse-cases\u002Fserp-tracking\">SERP追踪用例\u003C\u002Fa>和\u003Ca href=\"\u002Fcn\u002Fuse-cases\u002Fweb-scraping\">网页抓取场景\u003C\u002Fa>。完整API文档请参考\u003Ca href=\"https:\u002F\u002Fdocs.proxyhat.com\u002F\" rel=\"noopener noreferrer\">ProxyHat官方文档\u003C\u002Fa>。\u003C\u002Fp>","使用住宅代理在Python中构建Google排名追踪器 | ProxyHat","学习使用住宅代理在Python中构建Google排名追踪器：curl_cffi抓取SERP、分页解析、TLS指纹规避、重试策略与并发控制，完整代码示例。","\u002Fcn\u002Fblog\u002Fpython-google-paiming-zhuizong",null,"https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fpython-google-paiming-zhuizong-og.webp",[17,20],{"question":18,"answer":19},"为什么构建Google排名追踪器需要住宅代理？","Google使用TLS\u002FJA3-JA4指纹检测和IP信誉评分来识别自动化流量。数据中心代理IP信誉低，通常在几十次请求后就会被封锁或触发CAPTCHA。住宅代理使用真实ISP分配的IP，IP信誉高，结合城市级地理定位和粘性会话，可以模拟不同地区的真实搜索行为，大幅提升抓取成功率至99%以上。",{"question":21,"answer":22},"如何避免在构建Google排名追踪器时被封锁？","关键策略包括：使用curl_cffi的impersonate='chrome'模拟真实浏览器TLS指纹；为每个关键词分配粘性会话ID确保IP一致性；每页请求之间添加2-5秒随机延迟；实现指数退避重试机制（最多3次）；检测CAPTCHA标记并自动切换会话；限制并发数（建议5-10个）；单关键词每日查询不超过1-2次。低频场景可优先使用Google Custom Search API。",[24,25,26,27,28],"每日定时抓取SERP快照比一次性检查更能有效揭示关键词排名趋势和算法更新影响。","Google移除num=100后，需通过start参数分页抓取前100条结果，并在每页间添加随机延迟。","规避反爬封锁需使用住宅代理结合城市级地理定位和粘性会话，模拟真实家庭用户流量。","必须使用curl_cffi的impersonate='chrome'模拟TLS指纹，这是绕过JA3\u002FJA4检测的必要手段。","生产环境需加入指数退避重试、CAPTCHA检测和并发限制，低频场景则优先使用官方API。",false,"2026-07-02T16:04:58+00:00","2026-10-03T23:53:00+00:00","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fpython-google-paiming-zhuizong-master.webp","Build a Google Rank Tracker in Python with Residential Proxies","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fpython-google-paiming-zhuizong-card.webp",12,{"name":37,"slug":38,"bio":39,"avatar_url":14,"website_url":14,"social_links":14},"ProxyHat Team","proxyhat-team","The ProxyHat editorial team covers proxies, web scraping, and data extraction.",[41],{"id":42,"slug":43,"name":44,"description":14,"meta_title":45,"meta_description":46,"parent_id":14},3,"serp-he-seo","SERP与SEO追踪","SERP与SEO追踪指南 | ProxyHat 博客","如何使用代理追踪搜索引擎排名和抓取SERP数据。",[],{"de":49,"zh":13,"ko":50,"it":51,"ja":52,"ru":53,"tr":54,"es":55,"pl":56,"pt":57,"en":58,"fr":59,"x-default":58},"\u002Fde\u002Fblog\u002Fgoogle-rank-tracker-python-bauen","\u002Fko\u002Fblog\u002Fgoogle-rank-tracker-python-residential-proxy","\u002Fit\u002Fblog\u002Fcostruire-rank-tracker-python-proxy","\u002Fja\u002Fblog\u002Fpython-rank-tracker-residential-proxies","\u002Fru\u002Fblog\u002Fpostroit-treker-pozitsiy-google-python","\u002Ftr\u002Fblog\u002Fpython-google-siralama-takipcisi-residential-proxy","\u002Fes\u002Fblog\u002Fconstruir-rastreador-rankings-python-proxies-residenciales","\u002Fpl\u002Fblog\u002Fzbuduj-tracker-pozycji-python-proxy","\u002Fpt\u002Fblog\u002Frastreador-ranking-google-python-proxies-residenciais","\u002Fblog\u002Fbuild-rank-tracker-python-proxies","\u002Ffr\u002Fblog\u002Fcreer-tracker-positions-google-python-proxies",{"de":49,"zh":13,"ko":50,"it":51,"ja":52,"ru":53,"tr":54,"es":55,"pl":56,"pt":57,"en":58,"fr":59},58,[63,79,96,112],{"id":64,"slug":65,"title":66,"excerpt":67,"featured_image_url":68,"featured_image_alt":69,"card_image_url":70,"og_image_url":71,"published_at":72,"updated_at":72,"content_updated_at":73,"reading_time_minutes":35,"is_featured":29,"indexable":29,"views":74,"author":75,"categories":76,"tags":78},198,"serp-dili-dingwei-zhuaqu-zhinan","地理定位SERP抓取最佳实践：从uule到城市级代理的完整指南","掌握地理定位SERP抓取的核心参数uule\u002Fgl\u002Fhl\u002Fgoogle_domain，配合城市级住宅代理实现精确的本地SEO排名追踪。包含完整Python代码示例与生产级重试策略。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fserp-dili-dingwei-zhuaqu-zhinan-master.webp","Geo-Targeted SERP Scraping Best Practices for Local SEO Data","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fserp-dili-dingwei-zhuaqu-zhinan-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fserp-dili-dingwei-zhuaqu-zhinan-og.webp","2026-07-31T16:11:16+00:00","2026-11-17T09:21:33+00:00",74,{"name":37,"slug":38,"bio":39,"avatar_url":14,"website_url":14,"social_links":14},[77],{"id":42,"slug":43,"name":44,"description":14,"meta_title":45,"meta_description":46,"parent_id":14},[],{"id":80,"slug":81,"title":82,"excerpt":83,"featured_image_url":84,"featured_image_alt":85,"card_image_url":86,"og_image_url":87,"published_at":88,"updated_at":88,"content_updated_at":89,"reading_time_minutes":90,"is_featured":29,"indexable":29,"views":91,"author":92,"categories":93,"tags":95},155,"amazon-guanjianci-paiming-zhuizong-daili-1","使用代理追踪亚马逊关键词排名：开发者完整指南","面向亚马逊卖家和 SEO 开发者的代码实战指南——用住宅代理、Python 和 Playwright\u002Fcurl_cffi 追踪关键词自然排名，解析搜索结果页，分离广告与自然位，并覆盖生产级重试、CAPTCHA 检测与合规注意事项。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Famazon-guanjianci-paiming-zhuizong-daili-1-master.webp","Amazon Keyword Rank Tracking with Proxies: A Developer's Guide","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Famazon-guanjianci-paiming-zhuizong-daili-1-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Famazon-guanjianci-paiming-zhuizong-daili-1-og.webp","2026-07-16T16:05:31+00:00","2026-10-03T08:21:23+00:00",13,114,{"name":37,"slug":38,"bio":39,"avatar_url":14,"website_url":14,"social_links":14},[94],{"id":42,"slug":43,"name":44,"description":14,"meta_title":45,"meta_description":46,"parent_id":14},[],{"id":97,"slug":98,"title":99,"excerpt":100,"featured_image_url":101,"featured_image_alt":102,"card_image_url":103,"og_image_url":104,"published_at":105,"updated_at":105,"content_updated_at":106,"reading_time_minutes":35,"is_featured":29,"indexable":29,"views":107,"author":108,"categories":109,"tags":111},153,"zhuaqu-google-paa-zidongbuchquan-guanjianci","抓取Google People Also Ask与自动补全做关键词研究：Python实战指南","本指南教你用Python抓取Google自动补全、People Also Ask和相关搜索三大关键词金矿，结合ProxyHat住宅代理实现地理定位与防封锁，构建从种子词到长尾词的自动化扩展流程。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fzhuaqu-google-paa-zidongbuchquan-guanjianci-master.webp","Scrape Google People Also Ask and Autocomplete for Keyword Research (Python Guide)","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fzhuaqu-google-paa-zidongbuchquan-guanjianci-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fzhuaqu-google-paa-zidongbuchquan-guanjianci-og.webp","2026-07-14T16:06:25+00:00","2026-10-03T23:53:01+00:00",147,{"name":37,"slug":38,"bio":39,"avatar_url":14,"website_url":14,"social_links":14},[110],{"id":42,"slug":43,"name":44,"description":14,"meta_title":45,"meta_description":46,"parent_id":14},[],{"id":113,"slug":114,"title":115,"excerpt":116,"featured_image_url":117,"featured_image_alt":118,"card_image_url":119,"og_image_url":120,"published_at":121,"updated_at":121,"content_updated_at":31,"reading_time_minutes":122,"is_featured":29,"indexable":29,"views":123,"author":124,"categories":125,"tags":127},154,"zhui-zong-google-ai-gailan-pinpai","如何追踪Google AI Overviews中的品牌表现：生成式搜索时代的可见性测量框架","Google AI Overviews已覆盖约36%的信息类查询，传统蓝链点击被压缩，引用份额成为新的排名KPI。本文为SEO负责人和数据PM提供一套从数据采集到ROI计算的AI搜索可见性追踪框架。","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fzhui-zong-google-ai-gailan-pinpai-master.webp","How to Track Your Brand in Google AI Overviews: A Strategic Guide for SEO & Data Teams","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fzhui-zong-google-ai-gailan-pinpai-card.webp","https:\u002F\u002Fstatic.proxyhat.com\u002Fstorage\u002Fblog-covers\u002Fzh\u002Fzhui-zong-google-ai-gailan-pinpai-og.webp","2026-07-14T10:05:37+00:00",10,76,{"name":37,"slug":38,"bio":39,"avatar_url":14,"website_url":14,"social_links":14},[126],{"id":42,"slug":43,"name":44,"description":14,"meta_title":45,"meta_description":46,"parent_id":14},[],[]]