หน้าแรก เอกสาร บทช่วยสอน ลงชื่อเข้าใช้
ประเภทงานที่รองรับ
เมธอด API
บทความ
บทช่วยสอน
GitHub
เมนูเอกสาร

บายพาสหน้าจอ Anti-bot

งานประเภทนี้ที่พนักงานของเรานำทางไปยังหน้าเว็บตามที่คุณต้องการ ข้ามหน้าจอป้องกันบอท คว้าคุกกี้ และส่งกลับไปที่แอปของคุณ จากนั้นคุณสามารถใช้คุกกี้เหล่านี้เพื่อสำรวจเว็บไซต์นี้ได้อย่างอิสระด้วยภาษาโปรแกรมที่คุณชื่นชอบ หากต้องการหลีกเลี่ยงหน้าเว็บที่ดักจับบอทประเภทนี้ได้สำเร็จ คุณจะต้องมีค่า User-Agent ของเบราว์เซอร์ของผู้ปฏิบัติงานของเรา และมอบพร็อกซีที่มีคุณภาพดีให้กับเรา วิธีนี้จะใช้ไม่ได้หากไม่มีพร็อกซี เนื่องจากโซลูชันต่อต้านบอททั้งหมดจะจับคู่คุกกี้กับที่อยู่ IP ของผู้เข้าชมและ User-Agent ของพวกเขา

ตัวอย่างหน้าจอต่อต้านบอท

สิ่งที่เราได้รับในหน้าสุดท้าย:

  • คุ้กกี้
  • ลายนิ้วมือของเบราว์เซอร์
  • ส่วนหัวของคำขอ HTTP ล่าสุดที่สร้างจากกรอบหน้าต่างหลัก

เทคโนโลยีนี้สร้างขึ้นบน เทมเพลต AntiGate ของเรา ยกเว้นว่าเราจะจัดการเทมเพลตเองและอัปเดตให้ทันสมัยอยู่เสมอ การใช้งานประเภทนี้จะต้องมี การสมัครสมาชิก โดยมีค่าใช้จ่าย 5 เครดิตสำหรับแต่ละงาน ราคาการสมัครสมาชิกเริ่มต้นที่ $9.90 ต่อเดือนพร้อมบายพาส 5,000 ครั้ง หากคุณไม่ต้องการซื้อ คุณสามารถสร้างเทมเพลตได้เองโดยใช้ กวดวิชา นี้ และชำระเงินจากยอดคงเหลือต่อไปในราคาประมาณ $0.002 ต่องาน

กระบวนการทั้งหมดควบคุมโดยปลั๊กอินของเบราว์เซอร์ ซึ่งพนักงานของเราติดตั้งก่อนรับงาน พวกเขาไม่ได้ทำอะไรด้วยตนเอง โดยพื้นฐานแล้วแท็บใหม่จะเปิดขึ้นโดยอัตโนมัติโดยเปิดใช้งานพร็อกซีของคุณ นำทางไปยังหน้าที่คุณเลือก รอจนกระทั่งผ่านหน้าจอต่อต้านบอท ดึงข้อมูล ปิดแท็บและส่งข้อมูลไปยังแอปของคุณ ผ่าน API

ยอมรับเฉพาะพร็อกซีคุณภาพสูงเท่านั้น ไม่มีชื่อโฮสต์ ไม่มี "พร็อกซีประจำถิ่น" ไม่มีพร็อกซีพูลที่ใช้ร่วมกัน การเช่า VPS ในสหรัฐอเมริกา/ยุโรปและการติดตั้งเซิร์ฟเวอร์ SQUID ด้วย คำแนะนำ ของเราจะใช้งานได้เสมอ พร็อกซีจะได้รับการตรวจสอบความเร็วและความเข้ากันได้ก่อนดำเนินการงาน พวกเขาจะต้องมีเวลาตอบสนองที่รวดเร็วต่ำกว่า 1 วินาที มิฉะนั้นพนักงานจะยกเลิกงานของคุณ

ตรวจสอบว่าเว็บไซต์รองรับหน้าจอต่อต้านบอทหรือไม่:

โปรดทราบว่าหน้าจอป้องกันบอทบางหน้าจอใช้เทคนิคการพิมพ์ลายนิ้วมือขั้นสูง เช่น SSL handshake fingerprinting ซึ่งสามารถระบุได้ว่าไคลเอ็นต์ SSL/TLS ประเภทใดกำลังเชื่อมต่อกับเว็บไซต์ ตัวอย่างเช่น เบราว์เซอร์ Chrome มีหนึ่งลายนิ้วมือ Firefox อีกอันหนึ่งและ CURL หนึ่งอันที่ต่างกันโดยสิ้นเชิง อย่าสับสนตัวเองกับ User-Agent เป็นสิ่งที่อยู่ในระดับที่ต่ำกว่า ในกรณีนี้ หากต้องการใช้บริการของเรา คุณจะต้องใช้เบราว์เซอร์เดิมเพื่อสร้างเซสชันของผู้ปฏิบัติงานของเราใหม่ เนื่องจากพนักงานส่วนใหญ่ของเราใช้เบราว์เซอร์ Chrome ชุด NodeJS+Puppeteer+Chromium หรือ Selenium+Chromedriver จะทำงานแทน รวมตัวอย่าง

อ็อบเจ็กต์งาน

คุณสมบัติ ประเภท จำเป็น วัตถุประสงค์
type สตริง ใช่ AntiBotCookieTask
websiteURL สตริง ใช่ ที่อยู่ของหน้าเว็บเป้าหมายที่คนงานของเราจะนำทางไป
proxyAddress สตริง ใช่ ที่อยู่ IP ของพร็อกซี่ ipv4/ipv6 ไม่มีชื่อโฮสต์หรือที่อยู่ IP จากเครือข่ายใกล้ๆ กัน
proxyPort จำนวนเต็ม ใช่ พอร์ตพร็อกซี่
proxyLogin สตริง ใช่ ล็อกอินสำหรับพร็อกซี่ที่ต้องได้รับอนุญาต (พื้นฐาน)
proxyPassword สตริง ใช่ รหัสผ่านพร็อกซี่

ตัวอย่างคำขอ

CURL
          curl -i -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -X POST -d '{
    "clientKey":"YOUR_API_KEY_HERE",
    "task":
        {
            "type":"AntiBotCookieTask",
            "websiteURL":"https://somewebsite.com/",
            "proxyAddress":"8.8.8.8",
            "proxyPort":8080,
            "proxyLogin":"proxyLoginHere",
            "proxyPassword":"proxyPasswordHere"
        },
    "softId": 0
}' https://api.anti-captcha.com/createTask
        
PHP
          <?php

//git clone git@github.com:AdminAnticaptcha/anticaptcha-php.git

include("anticaptcha.php");
include("antibotcookie.php");

$api = new AntiBotCookie();
$api->setVerboseMode(true);

//your anti-captcha.com account key
$api->setKey("YOUR_API_KEY_HERE");

//target website address
$api->setWebsiteURL("https://somewebsite.com/");

//proxy access parameters
// DO NOT USE PURCHASED/RENTED PROXIES ON PROXY SERVICES!!!
// THEY WILL NOT WORK!
// USE ONLY PROXIES YOU INSTALL YOURSELF ON YOUR OWN SERVER OR FAST VPS
// USE PROPER PROXY SOFTWARE LIKE SQUID !
// INSTALLATION INSTRUCTIONS:
// https://anti-captcha.com/apidoc/articles/how-to-install-squid
$api->setProxyAddress("8.8.8.8");
$api->setProxyPort(1234);
//optional login and password
$api->setProxyLogin("login");
$api->setProxyPassword("password");

//Specify softId to earn 10% commission with your app.
//Get your softId here: https://anti-captcha.com/clients/tools/devcenter
$api->setSoftId(0);

//create task in API
if (!$api->createTask()) {
    $api->debout("API v2 send failed - ".$api->getErrorMessage(), "red");
    return false;
}

$taskId = $api->getTaskId();

//wait in a loop for max 300 seconds till task is solved
if (!$api->waitForResult(300)) {
    echo "could not solve captcha\n";
    echo $api->getErrorMessage()."\n";
} else {

    $result    =   $api->getTaskSolution();
    echo "\nTask result:\n";
    print_r($result);

    $assoc = json_decode(json_encode($api->getTaskSolution()), true);
    $userAgent = $assoc['fingerprint']['self.navigator.userAgent'];

    $cookies = [];
    foreach ($assoc["cookies"] as $name => $value) {
        $cookies[] = $name . "=" . $value;
    }
    $cookieStr = implode("; ", $cookies);

    echo "Use this User-Agent for your requests: $userAgent\n";
    echo "Use this cookies for your requests: $cookieStr\n";

    //example, may need to pass more headers with CURLOPT_HTTPHEADER:
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL, "https://somewebsite.com/");
    curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
    //set worker's user-agent
    curl_setopt($ch,CURLOPT_USERAGENT, $userAgent);
    //set cookies
    curl_setopt($ch,CURLOPT_HTTPHEADER, array(
        'Cookie: ' . $cookieStr
    ));
    //set your proxies
    curl_setopt($ch,CURLOPT_PROXY, "8.8.8.8:1234");
    curl_setopt($ch, CURLOPT_PROXYUSERPWD, "login:password");
    //retrieve the content
    $content = curl_exec($ch);

}
        
Python
          #pip3 install anticaptchaofficial

from anticaptchaofficial.antibotcookietask import *
import requests

solver = antibotcookieTask()
solver.set_verbose(1)
solver.set_key("API_KEY_HERE")
solver.set_website_url("https://www.somewebsite.com/")
solver.set_proxy_address("1.2.3.4")
solver.set_proxy_port(3128)
solver.set_proxy_login("login")
solver.set_proxy_password("password")

# Specify softId to earn 10% commission with your app.
# Get your softId here: https://anti-captcha.com/clients/tools/devcenter
solver.set_soft_id(0)

result = solver.solve_and_return_solution()
if result == 0:
    print("could not solve task")
    exit()

print(result)

cookies, localStorage, fingerprint = result["cookies"], result["localStorage"], result["fingerprint"]

if len(cookies) == 0:
    print("empty cookies, try again")
    exit()

cookie_string = '; '.join([f'{key}={value}' for key, value in cookies.items()])
user_agent = fingerprint['self.navigator.userAgent']
print(f"use these cookies for requests: {cookie_string}")
print(f"use this user-agent for requests: {user_agent}")

s = requests.Session()
proxies = {
  "http": "http://login:password@1.2.3.4:3128",
  "https": "http://login:password@1.2.3.4:3128"
}
s.proxies = proxies

content = s.get("https://www.somewebsite.com/", headers={
    "Cookie": cookie_string,
    "User-Agent": user_agent
}).text
print(content)
        
NodeJS
          //npm install @antiadmin/anticaptchaofficial
//https://github.com/AdminAnticaptcha/anticaptcha-npm

const ac = require("@antiadmin/anticaptchaofficial");

//set API key
ac.setAPIKey('YOUR_API_KEY_HERE');

//Specify softId to earn 10% commission with your app.
//Get your softId here: https://anti-captcha.com/clients/tools/devcenter
ac.setSoftId(0);

(async () => {

    let solution = null;
    try {
        solution = await anticaptcha.solveAntiBotCookieTask(
            checkUrl,
            proxyAddress,
            proxyPort,
            proxyLogin,
            proxyPassword);
    } catch (e) {
        console.error("could not solve captcha: "+e.toString());
        return;
    }

    const fingerPrint = solution.fingerprint;
    const targetCookies = joinCookies(solution.cookies);
    console.log(`joined cookies: ${targetCookies}`);
    console.log(`user-agent: ${fingerPrint['self.navigator.userAgent']}`);

    try {
        let responseText = await axios.request({
            url: checkUrl,
            httpsAgent: agent,
            headers: {
                'User-Agent': fingerPrint['self.navigator.userAgent'],
                'Cookie': targetCookies,
                'Accept-Encoding': 'deflate',
                'Accept': 'text/html',
                'Accept-Language': 'en'
            }
        });
        console.log(responseText.data);
    } catch (e) {
        console.error('Could not request page')
        console.log(e.toString());
    }

})();


function joinCookies(object) {
    let resultArray = [];
    for (const key in object) {
        resultArray.push(key+"="+object[key])
    }
    return resultArray.join("; ");
}
        
      
NodeJS with Puppeteer
          /*

npm install @antiadmin/anticaptchaofficial puppeteer

* */

const anticaptcha = require("@antiadmin/anticaptchaofficial");
const pup = require('puppeteer');

//address behind cloudflare
const checkUrl = 'https://www.thewebsite.com/';
const domainName = 'www.thewebsite.com';


//Anti-captcha.com API key
const apiKey = 'API_KEY_HERE';

// STOP! IMPORTANT! Shared proxy services won't work!
// Use ONLY self-installed proxies on your own infrastructure! Instruction: https://anti-captcha.com/apidoc/articles/how-to-install-squid
// Again and again people people insist they have best purchased proxies. NO YOU DO NOT!
// Absolutely recommended to read this FAQ about proxies: https://anti-captcha.com/faq/510_questions_about_solving_recaptcha_with_proxy__applies_to_funcaptcha__geetest__hcaptcha_


const proxyAddress = '1.2.3.4';
const proxyPort = 1234;
const proxyLogin = 'mylogin';
const proxyPassword = 'mypass';


let browser = null;
let page = null;


(async () => {

    anticaptcha.setAPIKey(apiKey);
    const balance = await anticaptcha.getBalance();
    if (balance <= 0) {
        console.log('Topup your anti-captcha.com balance!');
        return;
    } else {
        console.log('API key balance is '+balance+', continuing');
        // anticaptcha.shutUp(); //uncomment for silent captcha recognition
    }

    let antigateResult = null;
    try {
        antigateResult = await anticaptcha.solveAntiBotCookieTask(
            checkUrl,
            proxyAddress,
            proxyPort,
            proxyLogin,
            proxyPassword);
    } catch (e) {
        console.error("could not solve captcha: "+e.toString());
        return;
    }

    const fingerPrint = antigateResult.fingerprint;

    try {
        console.log('opening browser ..');


        let options = {
            headless: true, //disable to see the browser window
            devtools: false, //enable to see developers console
            args: [
                '--window-size='+fingerPrint['self.screen.width']+','+fingerPrint['self.screen.height'],
                `--proxy-server=${proxyAddress}:${proxyPort}`
            ],

        };
        browser = await pup.launch(options);

        console.log('creating new page ..');
        page = await browser.newPage();
    } catch (e) {
        console.log("could not open browser: "+e);
        return false;
    }

    if (proxyPassword && proxyLogin) {
        console.log(`setting proxy authentication ${proxyLogin}:${proxyPassword}`);
        await page.authenticate({
            username: proxyLogin,
            password: proxyPassword,
        });
    }

    //screen size
    console.log('setting view port to '+fingerPrint['self.screen.width']+'x'+fingerPrint['self.screen.height']);
    await page.setViewport({width: fingerPrint['self.screen.width'], height: fingerPrint['self.screen.height']});

    //user agent
    let userAgent = '';
    if (fingerPrint['self.navigator.userAgent']) {
        userAgent = fingerPrint['self.navigator.userAgent'];
    } else {
        if (fingerPrint['self.navigator.appVersion'] && fingerPrint['self.navigator.appCodeName']) {
            userAgent = fingerPrint['self.navigator.appCodeName'] + '/' + fingerPrint['self.navigator.appVersion']
        }
    }
    console.log('setting browser user agent to '+userAgent);
    await page.setUserAgent(userAgent);

    console.log('setting cookies', antigateResult.cookies);
    let cookies = [];
    for (const name in antigateResult.cookies) {
        cookies.push({ name: name, value: antigateResult.cookies[name], domain: domainName })
    }
    await page.setCookie(...cookies);

    try {
        await page.goto(antigateResult.url, {
            waitUntil: "networkidle0"
        });
    } catch (e) {
        console.log('err while loading the page: '+e);
    }

    const htmlContent = await page.content();
    console.log("page content:\n\n", htmlContent);


})();


      

ตัวอย่างการตอบกลับ

JSON ที่ไม่มีข้อผิดพลาด
          {
    "errorId": 0,
    "taskId": 7654321
}
        
JSON ที่มีข้อผิดพลาด
          {
    "errorId": 1,
    "errorCode": "ERROR_KEY_DOES_NOT_EXIST",
    "errorDescription": "Account authorization key not found in the system"
}
        

เรียกดูโซลูชัน

ใช้เมธอด getTaskResult เพื่อขอโซลูชัน โดยให้เวลาคนงานสัก 5 วินาทีก่อนส่งคำขอครั้งแรก หากคนงานยังไม่ว่าง ให้ลองอีกครั้งใน 3 วินาที

อ็อบเจ็กต์โซลูชันงาน

คุณสมบัติ ประเภท วัตถุประสงค์
cookies อ็อบเจ็กต์ คุกกี้จากหน้าหลังหน้าจอป้องกันบอท รวมเข้าด้วยกันและใช้ในคำขอ HTTP ของคุณ
localStorage อ็อบเจ็กต์ คล้ายกับคุกกี้ อ็อบเจกต์ที่มีค่า localStorage จะถูกดึงไว้ที่หน้าสุดท้าย
fingerprint อ็อบเจ็กต์ พารามิเตอร์เบราเซอร์ฟิงเกอร์พรินท์ใช้ร่วมกับคุกกี้และ localStorage เพื่อสร้างเซสชันเบราว์เซอร์ของคนงานในซอฟต์แวร์ของคุณ
ใช้ค่า self.navigator.userAgent เป็น user-agent ในคำขอ HTTP ของคุณ
url สตริง URL ของหน้าดำเนินการของเทมเพลตเสร็จแล้ว
lastRequestHeaders อาเรย์ ส่วนหัวคำขอล่าสุดที่ส่งไปยังเว็บไซต์จากกรอบหน้าต่างหลักของเบราว์เซอร์

ตัวอย่างการตอบกลับ

JSON ที่ไม่มีข้อผิดพลาด
          {
    "errorId": 0,
    "status": "ready",
    "solution": {
        "cookies": {
            "some_antibotcookie": "0A8VO9NX5N1s4LRoS4sJlFTCNzLj0dEfA_2whUh0E6ZjgQtM~I1cV7U2IhQx0~jnowNjg-Oi76b-MjYPd1GQAmIxh5-v~33PI8F",
            "maybe_another_id": "join_all_cookies_together"
        },
        "localStorage": {
            "some_value": "Might be used too in the future as a method to 'remember' visitors, so we collect it too.",
            "what_is_it": "localStorage is a more complex analogue of cookies, allowing to store larger objects in browser memory"
        },
        "fingerprint": {
            "self.navigator.userAgent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/101.0.0.0 Safari\/537.36",
            "self.screen.width": 1280,
            "self.screen.height": 768,
            "self.screen.availWidth": 1280,
            "self.screen.availHeight": 768,
            "self.screen.availLeft": 0,
            "self.screen.availTop": 25,
            "self.navigator.vendorSub": "",
            "self.navigator.productSub": "20030107",
            "self.navigator.vendor": "Google Inc.",
            "self.navigator.maxTouchPoints": 0,
            "self.navigator.hardwareConcurrency": 8,
            "self.navigator.cookieEnabled": true,
            "self.navigator.appCodeName": "Mozilla",
            "self.navigator.appName": "Netscape",
            "self.navigator.appVersion": "5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/101.0.0.0 Safari\/537.36",
            "self.navigator.platform": "MacIntel",
            "self.navigator.product": "Gecko",
            "self.navigator.language": "en-US",
            "self.navigator.onLine": true,
            "self.navigator.deviceMemory": 4
        },
        "url": "https://www.thewebsite.com/some/final/path/after_redirects",
        "lastRequestHeaders": [
            "sec-ch-device-memory: 8",
            "sec-ch-ua: \" Not A;Brand\";v=\"99\", \"Chromium\";v=\"101\", \"Google Chrome\";v=\"101\"",
            "sec-ch-ua-mobile: ?0",
            "sec-ch-ua-arch: \"x86\"",
            "sec-ch-ua-platform: \"macOS\"",
            "sec-ch-ua-model: \"\"",
            "sec-ch-ua-full-version-list: \" Not A;Brand\";v=\"99.0.0.0\", \"Chromium\";v=\"101.0.5005.115\", \"Google Chrome\";v=\"101.0.5005.115\"",
            "Upgrade-Insecure-Requests: 1",
            "User-Agent: Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/101.0.0.0 Safari\/537.36",
            "Accept: text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/avif,image\/webp,image\/apng,*\/*;q=0.8,application\/signed-exchange;v=b3;q=0.9",
            "Sec-Fetch-Site: same-origin",
            "Sec-Fetch-Mode: navigate",
            "Sec-Fetch-Dest: document",
            "Referer: https:\/\/somewebsite.com\/",
            "Accept-Encoding: gzip, deflate, br",
            "Accept-Language: en-US,en;q=0.9",
            "Cookie: some_antibotcookie=0A8VO9NX5N1s4LRoS4sJlFTCNzLj0dEfA_2whUh0E6ZjgQtM~I1cV7U2IhQx0~jnowNjg-Oi76b-MjYPd1GQAmIxh5-v~33PI8F"
        ]
    },
    "cost": "0.00858",
    "ip": "5.25.11.114",
    "createTime": 1637841143,
    "endTime": 1637841189,
    "solveCount": 0
}