AkamaiSBSD
Create a task through sync api https://sync.ez-captcha.com/createSyncTask, and get the result directly
If you obtain an invalid token, please contact us. It will usually work normally after we optimize it.
Task Type
Task Type | Description | Price(USD) |
|---|---|---|
AkamaiSBSDTaskProxyless | AkamaiSBSD solution | $2.5/k |
Sensor Data
Parameter | Type | Required | Description |
|---|---|---|---|
pageUrl | string | true | Enter the URL of the page you are currently going through. |
bmSo | string | true | If there is a bm_so cookie, upload the value of the bm_so cookie; otherwise, upload the value of the sbsd_o cookie. |
sbsdUrl | string | true | Get the address of the sbsd script. Note that for most websites, this URL will change based on each request, so it needs to be dynamically obtained. |
ua | string | true | The UserAgent used in your program (needs to be consistent) only supports Chrome's UserAgent. It is recommended to use the latest version of Chrom's UserAgent. |
lang | string | true | The language used is consistent with the accept-language in the request header, such as "en-GB", "en-US", etc. |
script_base64 | string | true | This value is the Base64 encoding format of the sbsd JavaScript script. |
Remarks
The lang parameter, the accept-language field in the request header, and the proxy’s region must be consistent.
ua only supports Chrome ua, it is recommended to use the latest version of Chrome ua.
The sbsd url of most websites changes randomly, so it needs to be dynamically obtained based on each request.
The value and order of the request header need to be highly consistent with the browser.
Create Task
Example
POST https://sync.ez-captcha.com/createSyncTask
Content-Type: application/json
{
"clientKey": "YourClientKey",
"task": {
"type": "AkamaiSBSDTaskProxyless",
"pageUrl":pageUrl,
"bmSo":bmSo,
"sbsdUrl":sbsdUrl,
"ua":ua,
"lang":lang,
"script_base64":script_base
}
}The API will return the payload in the response body, which is the data encrypted by base64 and represents the body data that needs to be sent after being decrypted by base64.
Response Example
The payload field returned is the value encoded in base64, and after decoding, it is submitted as body field data to the corresponding interface through POST.
{
"errorId": 0,
"solution": {
"payload": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
"status": "ready"
}
Code Example
import threading
import time
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import random
import string
import json
import tls_client
import os
import base64
import platform
from urllib.parse import urlparse, parse_qsl, urlencode, urlunparse, quote
import secrets
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
def solveSbsd(client_key,pageUrl,bmSo,sbsdUrl,ua,lang,script_base):
url = "https://sync.ez-captcha.com/createSyncTask"
data = {
"clientKey":client_key,
"task":{
"type": "AkamaiSBSDTaskProxyless",
"pageUrl":pageUrl,
"bmSo":bmSo,
"sbsdUrl":sbsdUrl,
"ua":ua,
"lang":lang,
"script_base64":script_base
}
}
resp = requests.post(url,json=data,timeout=10,verify=False)
time.sleep(random.uniform(0.8,1.5))
return resp.text
def get_middle_string_strict(text: str, before: str, after: str) -> str:
parts = text.split(before, 1)
if len(parts) < 2:
return ""
sub = parts[1].split(after, 1)
if len(sub) < 2: #
return ""
return sub[0]
def solve():
client_key = ""
proxy_self = ""
proxys = {
'http':'http://127.0.0.1:8887',
'https':'http://127.0.0.1:8887'
}
session = tls_client.Session(
client_identifier="chrome_133",
random_tls_extension_order=True,
)
session.proxies = proxys
url = ""
domain = ""
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
sec_ch_ca = '"Google Chrome";v="141", "Not?A_Brand";v="8", "Chromium";v="141"'
lang = "en-US"
contry = "us"
accept_lang = 'en-US,en;q=0.9'
headers = {
'sec-ch-ua':sec_ch_ca,
'sec-ch-ua-mobile':'?0',
'sec-ch-ua-platform':'"Windows"',
'upgrade-insecure-requests':'1',
'user-agent':user_agent,
'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.7',
'sec-fetch-site':'none',
'sec-fetch-mode':'navigate',
'sec-fetch-user':'?1',
'sec-fetch-dest':'document',
'accept-encoding':'gzip, deflate, br, zstd',
'accept-language':accept_lang,
'priority':'u=0, i'
}
session.headers = headers
resp = session.get(url,allow_redirects=False)
sbsd_url = get_middle_string_strict(resp.text,'/noscript><script type="text/javascript" src="', '" defer></sc')
sbsd_url = domain + sbsd_url
#slove sbsd
sbsd_header = {
'sec-ch-ua-platform':'"Windows"',
'user-agent':user_agent,
'sec-ch-ua':sec_ch_ca,
'sec-ch-ua-mobile':'?0',
'accept':'*/*',
'sec-fetch-site':'same-origin',
'sec-fetch-mode':'no-cors',
'sec-fetch-dest':'script',
'referer':url,
'accept-encoding':'gzip, deflate, br, zstd',
'accept-language':accept_lang
}
session.headers = sbsd_header
resp = session.get(sbsd_url,allow_redirects=True)
cookie_dict = session.cookies.get_dict()
# check bm_so
bm_so = ''
if 'bm_so' in cookie_dict:
bm_so = cookie_dict['bm_so']
elif 'sbsd_o' in cookie_dict:
bm_so = cookie_dict['sbsd_o']
script_base = base64.b64encode(resp.text.encode("utf-8")).decode("ascii")
sbsd_payload = solveSbsd(client_key,url,bm_so,sbsd_url,user_agent,lang,script_base)
body = json.loads(sbsd_payload)["solution"]["payload"]
body = '{"body":"'+base64.b64decode(body).decode("utf-8")+'"}'
sbsd_post_header = {
'sec-ch-ua-platform':'"Windows"',
'user-agent':user_agent,
'sec-ch-ua':sec_ch_ca,
'content-type':'application/json',
'sec-ch-ua-mobile':'?0',
'accept':'*/*',
'origin':domain,
'sec-fetch-site':'same-origin',
'sec-fetch-mode':'cors',
'sec-fetch-dest':'empty',
'referer':url,
'accept-encoding':'gzip, deflate, br, zstd',
'accept-language':accept_lang,
'priority':'u=1, i'
}
post_sbsd_url = "http"+get_middle_string_strict(sbsd_url,"http","?v=")
session.headers = sbsd_post_header
resp = session.post(post_sbsd_url,json=body)
if resp.status_code != 200:
print(resp.text)
print("sbsd cookie error")
return
cookie_dict = session.cookies.get_dict()
print(cookie_dict)
if __name__ == "__main__":
solve()
429 StatusCode
If you encounter this status code, please contact us and we will provide assistance.