プロキシ + User-Agentローテーション戦略:協調的アンチ検出

プロキシIPの回転をユーザエージェントとヘッダーの回転で調整して、検出を回避します。 ブラウザプロファイルシステム、TLSアライメント、地理的一貫性、および重みのある分布パターンが含まれています.

プロキシ + User-Agentローテーション戦略:協調的アンチ検出

なぜ座標回転マター

ユーザエージェントを回転させずにプロキシを回転させる — またはその逆に、検出可能な矛盾を作成します。 アンチボットシステムは、お使いのブラウザ ID で IP アドレスをクロスリファレンスします。 同じユーザエージェントが 1 時間で 50 個の異なる IP から表示される場合、または 1 つの IP が 10 個の異なるユーザエージェントでリクエストを送信したときに、自動化を信号します。

座標回転とは、プロキシIPとユーザーエージェント(関連するすべてのヘッダと一緒に)を一致したペアとして変更し、明確で現実的なユーザーの外観を作成します。 この記事は、私たちのカバーされた検出コンセプトに基づいて構築します アンチボット検出ガイド. .

アンチボットシステムが有能な回転を検知する方法

アンチボットシステムが有能な回転を検知する方法
パターンアンチボットシステムが見えるもの検出信号
同じUAの回転IP20か国から10分で「ユーザー」が現れます。強力なボット信号
同じIP、回転UAs同時にChrome、Firefox、Safariの1つのデバイス要求強力なボット信号
UA +ヘッダーのMismatchedFirefox スタイルの Sec-Ch-Ua ヘッダーを持つ Chrome UA即時フラグ
UAバージョンの不一致Chrome/131 のユーザ・エージェントが、Sec-Ch-Ua はバージョン 120 を言います即時フラグ
プラットフォームの一貫性macOS スタイルの Windows UA ヘッダーの受け入れ媒体信号

ユーザーエージェントプロファイルシステムの構築

ランダムなユーザーエージェント文字列を回転させるよりもむしろ、すべての相関ヘッダーを含む完全なブラウザプロファイルを構築します。

プロフィールの構造

# Python: Browser profile with all correlated headers
BROWSER_PROFILES = [
    {
        "name": "Chrome 131 Windows",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
        "headers": {
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
            "Accept-Language": "en-US,en;q=0.9",
            "Accept-Encoding": "gzip, deflate, br, zstd",
            "Sec-Ch-Ua": '"Chromium";v="131", "Not_A Brand";v="24"',
            "Sec-Ch-Ua-Mobile": "?0",
            "Sec-Ch-Ua-Platform": '"Windows"',
            "Sec-Fetch-Dest": "document",
            "Sec-Fetch-Mode": "navigate",
            "Sec-Fetch-Site": "none",
            "Sec-Fetch-User": "?1",
            "Upgrade-Insecure-Requests": "1",
            "Cache-Control": "max-age=0"
        }
    },
    {
        "name": "Chrome 131 macOS",
        "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
        "headers": {
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
            "Accept-Language": "en-US,en;q=0.9",
            "Accept-Encoding": "gzip, deflate, br, zstd",
            "Sec-Ch-Ua": '"Chromium";v="131", "Not_A Brand";v="24"',
            "Sec-Ch-Ua-Mobile": "?0",
            "Sec-Ch-Ua-Platform": '"macOS"',
            "Sec-Fetch-Dest": "document",
            "Sec-Fetch-Mode": "navigate",
            "Sec-Fetch-Site": "none",
            "Sec-Fetch-User": "?1",
            "Upgrade-Insecure-Requests": "1",
            "Cache-Control": "max-age=0"
        }
    },
    {
        "name": "Firefox 133 Windows",
        "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0",
        "headers": {
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "Accept-Language": "en-US,en;q=0.5",
            "Accept-Encoding": "gzip, deflate, br, zstd",
            "Sec-Fetch-Dest": "document",
            "Sec-Fetch-Mode": "navigate",
            "Sec-Fetch-Site": "none",
            "Sec-Fetch-User": "?1",
            "Upgrade-Insecure-Requests": "1",
            "Connection": "keep-alive"
        }
        # Note: Firefox does NOT send Sec-Ch-Ua headers
    }
]

ブラウザプロファイル間の重要な違い

ブラウザプロファイル間の重要な違い
ヘッダークロームフォレックスサファリ
Sec-Ch-Uaの特長プレゼント(バージョンあり)送信しない送信しない
Sec-Ch-Ua-プラットフォームプレゼント送信しない送信しない
お問い合わせ映像/avif、イメージ/webp を含むシンプルなフォーマット別の順序
受入言語en-US、en;q=0.9en-US,en;q=0.5お問い合わせ アメリカ
アクセプトエンコーディングgzip、deflate、br、zstdgzip、deflate、br、zstdgzip、deflate、br

座標回転の実装

Pythonの実装

# Python: Coordinated proxy + UA rotation with ProxyHat
from curl_cffi import requests as curl_requests
import random
import time
class CoordinatedRotator:
    def __init__(self, proxy_user, proxy_pass, profiles):
        self.proxy_base = f"{proxy_user}:{proxy_pass}@gate.proxyhat.com:8080"
        self.profiles = profiles
        self.session_count = 0
    def create_session(self):
        """Create a new session with matched proxy + profile."""
        profile = random.choice(self.profiles)
        session_id = f"s{self.session_count}-{random.randint(1000, 9999)}"
        self.session_count += 1
        proxy_url = f"http://{self.proxy_base}"
        session = curl_requests.Session(impersonate="chrome")
        session.proxies = {
            "http": proxy_url,
            "https": proxy_url
        }
        session.headers.update(profile["headers"])
        session.headers["User-Agent"] = profile["user_agent"]
        return session, profile["name"]
    def scrape(self, urls, requests_per_session=20):
        """Scrape URLs with coordinated rotation."""
        results = []
        session, profile_name = self.create_session()
        req_count = 0
        for url in urls:
            # Rotate session after N requests
            if req_count >= requests_per_session:
                session, profile_name = self.create_session()
                req_count = 0
            try:
                response = session.get(url, timeout=30)
                results.append({
                    "url": url,
                    "status": response.status_code,
                    "profile": profile_name
                })
            except Exception as e:
                results.append({"url": url, "error": str(e)})
            req_count += 1
            time.sleep(random.uniform(1.0, 3.0))
        return results
# Usage
rotator = CoordinatedRotator("USERNAME", "PASSWORD", BROWSER_PROFILES)
results = rotator.scrape(url_list, requests_per_session=25)

Node.js 実装

// Node.js: Coordinated rotation with got-scraping
import { gotScraping } from 'got-scraping';
const PROFILES = [
  {
    name: 'Chrome Windows',
    headerGeneratorOptions: {
      browsers: ['chrome'],
      operatingSystems: ['windows'],
      devices: ['desktop'],
    }
  },
  {
    name: 'Chrome macOS',
    headerGeneratorOptions: {
      browsers: ['chrome'],
      operatingSystems: ['macos'],
      devices: ['desktop'],
    }
  },
  {
    name: 'Firefox Windows',
    headerGeneratorOptions: {
      browsers: ['firefox'],
      operatingSystems: ['windows'],
      devices: ['desktop'],
    }
  }
];
async function scrapeWithCoordinatedRotation(urls) {
  const results = [];
  let sessionCount = 0;
  for (const url of urls) {
    const profile = PROFILES[sessionCount % PROFILES.length];
    const sessionId = `rot-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
    try {
      const response = await gotScraping({
        url,
        proxyUrl: `http://USERNAME-session-${sessionId}:PASSWORD@gate.proxyhat.com:8080`,
        headerGeneratorOptions: profile.headerGeneratorOptions,
      });
      results.push({ url, status: response.statusCode, profile: profile.name });
    } catch (error) {
      results.push({ url, error: error.message });
    }
    sessionCount++;
    await new Promise(r => setTimeout(r, 1000 + Math.random() * 2000));
  }
  return results;
}

セッション時間と回転頻度

回転頻度は、ターゲットとユースケースによって異なります。

セッション時間と回転頻度
スケナリオ回転頻度セッション期間
結果ページを検索1-3リクエストごとにシングルリクエスト
製品カタログ閲覧10-30件のリクエスト5~15分
価格監視すべての 5-15 リクエスト2-5分
アカウントベースの操作アカウントセッション完全なセッションの長さ
SERPトラッキング毎 1-5 問い合わせシングルクエリ

地理的一貫した回転

幾何学的なコンテンツをスクレイピングするとき、あなたの回転は地理的一貫性を維持しなければなりません:

# Python: Geo-consistent proxy + UA rotation
GEO_PROFILES = {
    "us": {
        "proxy_suffix": "-country-us",
        "accept_language": "en-US,en;q=0.9",
        "timezone": "America/New_York"
    },
    "gb": {
        "proxy_suffix": "-country-gb",
        "accept_language": "en-GB,en;q=0.9",
        "timezone": "Europe/London"
    },
    "de": {
        "proxy_suffix": "-country-de",
        "accept_language": "de-DE,de;q=0.9,en;q=0.5",
        "timezone": "Europe/Berlin"
    }
}
def get_geo_session(target_country, proxy_user, proxy_pass):
    geo = GEO_PROFILES[target_country]
    proxy_url = f"http://{proxy_user}{geo['proxy_suffix']}:{proxy_pass}@gate.proxyhat.com:8080"
    session = curl_requests.Session(impersonate="chrome")
    session.proxies = {"http": proxy_url, "https": proxy_url}
    session.headers["Accept-Language"] = geo["accept_language"]
    return session
# Each session has matching proxy country + language headers
us_session = get_geo_session("us", "USERNAME", "PASSWORD")
de_session = get_geo_session("de", "USERNAME", "PASSWORD")

使用条件 ProxyHatのジオターゲティング IP、言語、コンテンツのアライメントを確保します。

高度:重くされたプロフィールの配分

実際のブラウザのトラフィックは予測可能な分布に従います。 Chromeは、SafariとFirefoxの市場シェアを支配します。 あなたの回転は現実世界のブラウザの使用パターンを映すべきです:

# Python: Weighted profile selection matching real browser market share
import random
WEIGHTED_PROFILES = [
    # (profile, weight) — weights approximate real browser market share
    (chrome_windows_profile, 45),   # Chrome Windows: ~45%
    (chrome_macos_profile, 20),     # Chrome macOS: ~20%
    (safari_macos_profile, 15),     # Safari macOS: ~15%
    (firefox_windows_profile, 8),   # Firefox Windows: ~8%
    (chrome_linux_profile, 5),      # Chrome Linux: ~5%
    (edge_windows_profile, 5),      # Edge Windows: ~5%
    (firefox_macos_profile, 2),     # Firefox macOS: ~2%
]
def weighted_choice(weighted_items):
    profiles, weights = zip(*weighted_items)
    return random.choices(profiles, weights=weights, k=1)[0]
# Each selection follows realistic browser distribution
selected_profile = weighted_choice(WEIGHTED_PROFILES)

TLS指紋アライメント

座標回転を延長しなければなりません TLS指紋 レイヤー。 各ユーザーエージェントプロファイルには、マッチングTLS署名が必要です。

TLS指紋アライメント
ユーザーエージェントクレーム必要な TLS の指紋図書館利用
クロム(任意のバージョン)BoringSSLフィンガープリントcurl cffi impersonate="クロム"
フォレックスNSS指紋curl cffi impersonate="firefox" を置き換える
サファリアップルTLS指紋curl cffi impersonate="safari" は、
# Python: TLS-aligned rotation
from curl_cffi import requests as curl_requests
TLS_PROFILES = {
    "chrome": {"impersonate": "chrome", "ua_prefix": "Chrome"},
    "firefox": {"impersonate": "firefox110", "ua_prefix": "Firefox"},
    "safari": {"impersonate": "safari15_5", "ua_prefix": "Safari"},
}
def create_tls_aligned_session(browser_type, proxy_user, proxy_pass):
    profile = TLS_PROFILES[browser_type]
    proxy_url = f"http://{proxy_user}:{proxy_pass}@gate.proxyhat.com:8080"
    session = curl_requests.Session(impersonate=profile["impersonate"])
    session.proxies = {"http": proxy_url, "https": proxy_url}
    return session
# TLS fingerprint matches the claimed browser
chrome_session = create_tls_aligned_session("chrome", "USERNAME", "PASSWORD")
firefox_session = create_tls_aligned_session("firefox", "USERNAME", "PASSWORD")

回転中の一般的な間違い

  • 削除されたリストからランダム UA 文字列: 2026 の Chrome/90 ユーザエージェントは赤色フラグです。 UA 文字列を最新のリリースの 2 〜 3 版以内に保持します。
  • 相関ヘッダーの欠如: Sec-Ch-Ua、Sec-Ch-Ua-Platform をアップデートせずに UA を変更し、ヘッダを受け入れると一貫性が崩れます。
  • あまりにも多くのユニークなUAs: 100種類のユーザーエージェントが疑わしい。 5-10の現実的なプロフィールに棒を付けて下さい。
  • 無視する ブラウザの指紋: : : ヘッドレスブラウザを使用する場合は、指紋は要求されたブラウザ/OSの組み合わせと一致しなければなりません。
  • ジオアライメントなしで回転: ドイツのIPから米国英語ユーザーエージェントが疑わしい。
最高の回転戦略は、自然交通パターンを模倣するものです。 よく作られた、内部的に一貫したプロファイルは、数のランダムで矛盾しないものを上回ります。

監視と検証

これらのメトリクスで回転効率を追跡します。

  • プロフィールによる成功率: 1つのプロファイルが一貫して失敗すると、指紋が押されたことがあります。
  • 回転頻度によるブロック率: セッションごとに最適なリクエスト数を検索します。
  • CAPTCHA率: CAPTCHA のスパイクは検出を示します — 回転パラメータを調整します。
  • 応答コンテンツの検証: 蜜蜂の巣のコンテンツではなく、実際のデータを受け取ることを確認してください。

包括的なスクレイピング戦略については、ガイドを参照してください プロキシ選択 そして、 検出の減少。SDKの統合のために、訪問して下さい ProxyHatのドキュメント. .

よくある質問

始める準備はできましたか?

AIフィルタリングで148か国以上、5,000万以上のレジデンシャルIPにアクセス。

料金を見るレジデンシャルプロキシ
← ブログに戻る