🥳Join the Scrapeless Community and Claim Your Free Trial to Access Our Powerful Web Scraping Toolkit!
Back to Blog

Why Base Playwright Isn’t Enough to Bypass Akamai

Anna
Anna

Anna is Scrapeless' developer, ...

03-Apr-2025

Why Base Playwright Isn’t Enough to Bypass Akamai

Playwright’s strength lies in its ability to control headless browsers like Chromium, Firefox, and WebKit, rendering dynamic content seamlessly. Yet, when scraping Akamai-protected sites, it encounters roadblocks due to Akamai’s multi-layered detection techniques:

  • Browser Fingerprinting: Akamai checks properties like navigator.webdriver (set to true in headless mode) to identify automation tools.
  • IP Analysis: It flags data center IPs or those with suspicious activity patterns.
  • Behavioral Checks: It monitors mouse movements, click patterns, and navigation sequences to distinguish bots from humans.
    To illustrate, let’s try scraping an Akamai-protected site like Zalando using base Playwright:

    Best Methods to Bypass Akamai With Playwright
    To overcome Akamai’s defenses, we’ll detail three methods: using Scrapeless (the recommended approach), the Playwright Stealth plugin, and premium proxies. Each method includes detailed steps, code, and graphic descriptions.

Method 1: Use Scrapeless to Bypass Akamai(Recommended)

Scrapeless is a web scraping API tailored to defeat anti-bot systems like Akamai. It generates critical tokens (e.g., _abck and bm_sz cookies, sensor data) and manages proxies, ensuring high success rates with minimal effort. By integrating Scrapeless with Playwright, you can bypass Akamai’s checks effectively.

Why Scrapeless Excels

Token Generation: Provides Akamai-specific cookies and sensor data to pass initial verification.
Proxy Rotation: Uses premium proxies to mask your IP and avoid blocks.
Ease of Use: Handles complex bypassing logic, reducing manual configuration.
Step-by-Step Guide

Sign Up and Get API Key

Register at Scrapeless and retrieve your API key from the dashboard.

Unlock Faster, More Efficient Web Scraping Today!
Bypass Akamai and scale your web scraping tasks effortlessly with Scrapeless. Get started now and experience seamless integration with advanced scraping tools!
Log in to Scrapeless now.

Generate Akamai Cookies

Use the Scrapeless /api/v1/unlocker/request endpoint (Web Unlocker: Akamaiweb Cookie) to fetch _abck and bm_sz cookies.
Code:

import http.client Copy
   import json

   conn = http.client.HTTPSConnection("api.scrapeless.com")
   payload = json.dumps({
   "actor": "unlocker.akamaiweb",
   "input": {
       "type": "cookie",
       "url": "https://www.zalando.fr/release-calendar/homme-sneakers/",
       "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",

   },
   "proxy": {
       "country": "FR"
   }
   })
   headers = {
   'Content-Type': 'application/json',
   'x-api-token': 'YOUR API KEY'
   }
   conn.request("POST", "/api/v1/unlocker/request", payload, headers)
   res = conn.getresponse()
   data = res.read()
   print(data.decode("utf-8"))

Set Cookies in Playwright: Not Recommended
While injecting cookies into Playwright is technically possible, it's generally not the best approach for bypassing Akamai protections. Automated browsers like Playwright have numerous "fingerprints" that make them easily detectable, even with valid cookies.

Why it's problematic:

Modern websites easily detect automated browsers through JavaScript fingerprinting
Akamai cookies often have additional properties tied to the original browser
The way Playwright executes JavaScript differs from a normal browser
Recommended alternative:

Use a simple HTTP request with appropriate cookies and headers
Code for HTTP request:

import requests Copy
headers = {
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
    "Accept-Language": "en-US,en;q=0.9",
    "Sec-Fetch-Dest": "document"
}

cookies = {
    "_abck": "0E868C6CC7CA82A40139ACBF093E8CDE~-1~YAAQyIMQAoFI7L2VAQAA4tUo6Q1z...",
    "bm_sz": "BF4B4DAA3C6506FF52A615374EA95300~YAAQyIMQAj5B7L2VAQAA474o6Rv..."
}

response = requests.get("https://www.zalando.com", headers=headers, cookies=cookies)
content = response.text

Handle Sensor Data (If Needed)

For sites requiring sensor data, use the "Akamaiweb Sensor" endpoint and inject it via Playwright.
Refer to Scrapeless Documentation for specifics.
Advantages
Scrapeless simplifies bypassing Akamai by automating token generation and proxy management, offering a 90%+ success rate based on its optimized infrastructure.

Method 2: Use the Playwright Stealth Plugin to Bypass Akamai

The Playwright Stealth plugin modifies Playwright to evade basic detection by altering browser fingerprints (e.g., hiding navigator.webdriver).

The steps to use the Playwright Stealth Plugin to Bypass Akamai are as follows:

Install the Plugin
Run: pip install playwright-stealth
Apply Stealth to Playwright
Code:

At Scrapeless, we only access publicly available data while strictly complying with applicable laws, regulations, and website privacy policies. The content in this blog is for demonstration purposes only and does not involve any illegal or infringing activities. We make no guarantees and disclaim all liability for the use of information from this blog or third-party links. Before engaging in any scraping activities, consult your legal advisor and review the target website's terms of service or obtain the necessary permissions.

Most Popular Articles

Catalogue