Handle Akamai-Protected Pages With Scrapeless Scraping Browser
Advanced Bot Mitigation Engineer
TL;DR:
- Treat an Akamai-related scraping failure as a representation problem. Record the final URL, title, content type, cookies, and required business marker before changing the client.
- A proxy changes only the network-origin layer. Akamai products can evaluate transport, HTTP, JavaScript, browser, session, and behavior signals as well.
- Use a browser session when the permitted public page needs JavaScript and continuity. Keep geography, fingerprint, cookies, and navigation inside one bounded Scrapeless Scraping Browser session.
- Validate content, not only status codes. A normal status can still contain a challenge, consent shell, or unrelated page.
- Do not treat this workflow as permission. Use public or explicitly authorized pages, keep request volume proportionate, and stop at login, access-control, or contractual boundaries.
An Akamai-protected page can return different content for a normal browser and a direct HTTP client. The script may receive a challenge document, a redirect, or an application shell with the required fields missing.
The engineering task is to identify which representation arrived and choose the least complex permitted acquisition route that returns the expected public content. This tutorial uses Scrapeless Scraping Browser for pages that genuinely require JavaScript, cookies, and session continuity. It does not provide an exploit or instructions for accessing restricted resources.
What Akamai Bot Protection Evaluates
Akamai provides edge security, application protection, and bot-management products. A site can combine those controls with its own authentication, authorization, rate limits, and business rules.
Akamai's web-scraper protection documentation explains that sites may deploy content-protection detections for scraping activity.
That product context does not identify the cause of one response. A site may return an alternate page because of region, consent state, application policy, account status, traffic history, or a security decision. Diagnose the returned content before attributing it to a single signal.
Common Symptoms on Akamai-Protected Pages
| Symptom | What it establishes | What remains unknown |
|---|---|---|
| Redirect to a validation page | The ordinary page was not returned directly | Which layer triggered the redirect |
| Normal status with challenge text | HTTP transport completed | Whether business content is present |
| Direct HTTP fails while a browser works | Browser state affects representation | Which browser or session signal matters |
| First page loads and later navigation changes | Sequence or session state affects the result | Whether cookies, route, or policy caused it |
| Page differs by market | Geography or localization affects content | Whether access is denied elsewhere |
| DOM exists but selectors return nothing | The parser did not find its expected fields | Whether the page, timing, or selector is wrong |
Save a small diagnostic record for each test: requested URL, final URL, page title, content type, canonical URL, required marker, and a short body hash. Avoid collecting full uncontrolled pages when those fields are enough to compare outcomes.
Signals That Can Affect the Result
IP origin and geography
The apparent source address, network type, country, and connection history can affect localization or access policy. A residential proxy can provide a market-specific origin. It does not execute JavaScript, create browser storage, or grant permission.
TLS and transport behavior
TLS negotiation exposes protocol behavior associated with the client stack. The TLS 1.3 specification defines the handshake and negotiated parameters. Two clients requesting the same URL can therefore look different before HTTP headers are considered.
HTTP semantics
Methods, headers, redirects, content negotiation, and intermediaries shape the request and response. The HTTP semantics specification defines these fields.
Copying a browser's User-Agent string into a direct client does not reproduce the surrounding header set, transport behavior, cookie state, JavaScript runtime, or navigation sequence.
JavaScript and browser state
A browser executes scripts, loads dependent resources, exposes runtime properties, updates the DOM, and maintains storage. Use that capability only when the approved content needs it. The acceptance condition should name a required content marker rather than relying on an arbitrary delay.
Cookies and session continuity
Cookies preserve state across navigation. The HTTP state-management specification defines how servers set cookies and user agents return them.
When a public workflow moves from a homepage to a search page and then a detail page, keep those steps in one browser session. Changing geography, network route, or browser identity mid-sequence can change the returned representation.
Behavior and application policy
Navigation order, request rate, form use, account state, and custom application rules may also matter. If the required content is behind a login or explicit restriction, stop and obtain an approved access method.
Choose the Acquisition Route
| Route | Use when | Team owns | Acceptance check |
|---|---|---|---|
| Direct HTTP | Required fields exist in open server-rendered HTML | Headers, cookies, parsing, validation | Required marker appears in the response |
| Self-managed browser | The page needs JavaScript or permitted interaction | Browser lifecycle, routing, sessions, updates | Required marker appears in the rendered DOM |
| Scrapeless Scraping Browser | The team wants CDP control without running browser infrastructure | Navigation, selectors, schema, collection policy | Page identity and required fields pass |
| Managed page API | The deliverable is acquired page content | Request contract and result validation | Returned document matches approved page identity |
Start with direct HTTP. Move to a browser only when the page's behavior provides evidence that rendering or session continuity is required.
Scrapeless Scraping Browser connects through the Chrome DevTools Protocol and works with Playwright or Puppeteer. Its connection parameters support a session lifetime, session name, geographic proxy routing, and an optional fingerprint configuration.
The Scrapeless Scraping Browser guide demonstrates the same CDP connection pattern for a JavaScript-rendered target.
Prerequisites
The example below requires:
- Node.js 20 or later;
- Playwright Core installed with
npm install playwright-core; - a Scrapeless API key stored in
SCRAPELESS_API_KEY; - an authorized public target stored in
AUTHORIZED_TARGET_URL; - one expected content selector stored in
EXPECTED_SELECTOR; - a documented country code for the dataset, such as
US.
The block is a prerequisite-gap example because this article does not have the reader's credential or an authorized Akamai-protected target. The connection shape is based on current Scrapeless Scraping Browser documentation; run it only within the project's approved scope.
Build a Bounded Browser Session
The script keeps one session, visits the target's origin first, navigates to the approved target, and validates page identity plus a required DOM marker. It does not submit forms, log in, solve account controls, or discover additional URLs.
javascript
const { chromium } = require('playwright-core');
const apiKey = process.env.SCRAPELESS_API_KEY;
const targetUrl = process.env.AUTHORIZED_TARGET_URL;
const expectedSelector = process.env.EXPECTED_SELECTOR;
if (!apiKey || !targetUrl || !expectedSelector) {
throw new Error(
'Set SCRAPELESS_API_KEY, AUTHORIZED_TARGET_URL, and EXPECTED_SELECTOR'
);
}
const target = new URL(targetUrl);
if (target.protocol !== 'https:') {
throw new Error('AUTHORIZED_TARGET_URL must use HTTPS');
}
const query = new URLSearchParams({
token: apiKey,
sessionTTL: '180',
sessionName: 'authorized-akamai-diagnostic',
proxyCountry: 'US',
});
const connectionURL =
`wss://browser.scrapeless.com/api/v2/browser?${query.toString()}`;
(async () => {
const browser = await chromium.connectOverCDP(connectionURL);
try {
const context = browser.contexts()[0] || await browser.newContext();
const page = await context.newPage();
await page.goto(target.origin, {
waitUntil: 'domcontentloaded',
timeout: 60_000,
});
await page.goto(target.href, {
waitUntil: 'domcontentloaded',
timeout: 60_000,
});
await page.locator(expectedSelector).first().waitFor({
state: 'visible',
timeout: 20_000,
});
const result = {
requestedUrl: target.href,
finalUrl: page.url(),
title: await page.title(),
canonicalUrl: await page
.locator('link[rel="canonical"]')
.first()
.getAttribute('href'),
requiredMarkerFound: true,
};
if (new URL(result.finalUrl).hostname !== target.hostname) {
throw new Error(`Unexpected final host: ${result.finalUrl}`);
}
console.log(JSON.stringify(result, null, 2));
} finally {
await browser.close();
}
})().catch((error) => {
console.error(error.message);
process.exitCode = 1;
});
Keep the selector tied to a stable business element, such as a product identifier or public article title. Avoid brittle generated class names when an accessible role, canonical element, or structured attribute is available.
Validate the Returned Content
Do not send every rendered page straight to the parser. Create an acquisition result with explicit states.
| Result state | Meaning | Next action |
|---|---|---|
accepted |
Page identity and required marker match | Parse approved fields |
content_absent |
Correct host, required content missing | Review rendering, selector, or page change |
unexpected_page |
Redirect, challenge, consent, or unrelated content | Stop and inspect the representation |
policy_review |
Login, private data, or access boundary encountered | Obtain authorization or supported access |
network_error |
Connection failed before page validation | Diagnose transport and service health |
A content contract should include requested URL, final URL, canonical URL, observed time, locale, page identity, required markers, and validation state. This keeps challenge documents and empty shells out of the business dataset.
Use Session Continuity Carefully
Set one session lifetime long enough for the approved navigation and no longer. The Scraping Browser documentation documents sessionTTL and geographic routing parameters.
Keep the following stable inside a session:
- proxy country and any required regional setting;
- browser fingerprint configuration;
- cookie jar and local storage;
- navigation origin and page sequence;
- language and viewport when the dataset depends on them.
Do not share one authenticated session across unrelated users or jobs. This tutorial covers public or explicitly authorized content and does not require login.
Troubleshooting Matrix
| Observation | Inspect | Controlled change | Pass condition |
|---|---|---|---|
| Final host is unexpected | Redirect chain and policy boundary | None until reviewed | Final host remains approved |
| Correct page title, missing data | Rendering and selector | Replace one brittle selector | Required business marker is visible |
| Consent page returned | Locale and consent requirements | Apply the approved consent path | Ordinary public page appears |
| Page works only after origin visit | Session state | Keep origin and target in one session | Same marker passes consistently |
| Different market content appears | Proxy country and language | Pin required market | Dataset locale matches contract |
| Browser page changes across runs | Source drift or randomized DOM | Prefer semantic locators and canonical data | Required fields remain complete |
| Direct client works but parser fails | Extraction logic | Test saved permitted sample | Schema validates |
Change one variable at a time. If country, session, selector, and target all change together, the test cannot identify which condition affected the result.
Scale Only After the Contract Is Stable
Run a small representative set before adding concurrency. Include each public page template required by the job: search, category, detail, or article. Record accepted pages, unexpected pages, duration, and cost per accepted record.
Begin with concurrency of three or fewer sessions. Increase it only when the site's published rules, the project's authorization, and observed stability support more traffic. Add jitter only for workload scheduling, not to imitate a person or evade a control.
Review Scrapeless pricing using browser minutes and accepted records from the representative set. Raw navigation count does not reflect data quality.
Handle Public Web Data Responsibly
Akamai protection does not decide whether a collection project is lawful or permitted. Review authorization, source terms, applicable law, content rights, privacy obligations, and intended use independently.
Keep the boundary narrow:
- collect public or explicitly authorized pages only;
- stop at login, private areas, or explicit access restrictions;
- minimize collected fields and retention;
- use proportionate request rates;
- preserve provenance and deletion rules;
- route disputed access to legal and security owners.
The goal is a stable, reviewable acquisition path within an approved scope, not defeating a site's security policy.
Conclusion: Diagnose the Representation, Then Pick the Route
An Akamai-related failure can involve network origin, transport, HTTP, JavaScript, browser state, cookies, behavior, or application policy. Record the returned page and required marker before changing tools.
Use direct HTTP for open HTML, a bounded browser session for permitted JavaScript and navigation, and a managed acquisition API when the application needs validated content without owning browser infrastructure. Scale only after page identity and schema checks pass across representative pages.
Test One Authorized Public Page
Create a Scrapeless account, select one authorized public URL, and run the content contract before adding more targets. Keep the final host, canonical URL, and required selector in the test result.
FAQ
Q: Is it legal to scrape an Akamai-protected website?
Legality and permission depend on the source, jurisdiction, terms, data type, authorization, access method, and intended use. Protection technology alone does not answer the question. Obtain legal guidance for the specific project.
Q: Is a residential proxy enough for an Akamai-protected page?
No. A proxy changes network origin and can support required geography, but it does not execute JavaScript, preserve browser state, validate content, or grant access permission.
Q: Is Akamai the same as a web application firewall?
Akamai offers several security and delivery products, and a site can combine bot management with web application firewall controls and custom application rules. One response does not identify which product or rule made the decision.
Q: How should a scraper handle rotating DOM selectors?
Prefer stable page identity, semantic roles, canonical elements, structured attributes, and source-specific schema tests. Treat a missing required marker as a validation failure rather than returning an empty record.
Q: What concurrency should an Akamai web scraping test use?
Start with three or fewer sessions on a small approved page set. Increase only when authorization, source rules, and measured stability support the additional traffic.
Q: Does this workflow require an AI agent?
No. A deterministic Playwright script is easier to test for a known navigation path. Add an agent only when the task has genuinely uncertain intermediate steps and the application can enforce tool permissions.
Q: Why validate canonical URLs?
Canonical URLs help confirm page identity, normalize duplicates, and detect unexpected navigation. They should be checked alongside final host and required content markers, not used as the only acceptance signal.
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.



