# DuckDuckGo Search Scraper (`searchapi/duckduckgo-search-scraper`) Actor

Scrapes organic search results from DuckDuckGo for any query. Extracts page title, URL, displayed URL, domain, snippet, sitelinks, thumbnail, ratings, dates, rich result type, and more.

- **URL**: https://apify.com/searchapi/duckduckgo-search-scraper.md
- **Developed by:** [Search API](https://apify.com/searchapi) (community)
- **Categories:** SEO tools, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 26.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.99 / 1,000 search results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## DuckDuckGo Search Scraper

Fast, source-backed organic web-search extraction from DuckDuckGo's public HTML search interface. The Actor accepts ordinary search fields, submits the search itself, follows bounded continuation forms, and writes one normalized record per result.

### Modes and filters

- One query with `query`
- Multiple queries with `query` plus `queries`, processed concurrently and interleaved fairly
- First matching item with `maxItems: 1`
- Bounded pagination with `maxPages`
- DuckDuckGo region, Safe Search, and day/week/month/year filters
- Global and per-query record caps
- Direct access by default, with optional authorized Apify Residential or custom proxy URLs

`GOOGLE_SERP` is deliberately rejected because that proxy group supports Google Search and Shopping, not DuckDuckGo.

### Output

Records include a stable query-specific ID; global, query, page, and page-local positions; title and source emphasis HTML; snippet and emphasized terms; decoded destination and displayed URLs; destination domain; favicon; exact query and filter context; public search URL; locale; provenance; and scrape timestamp. Optional fields are omitted when DuckDuckGo does not provide them. Sponsored cards and their tracking URLs are excluded. Internal continuation tokens, cookies, transport headers, and redirect signatures are never stored.

### Example input

The public input form starts with a direct single-query preview for `artificial intelligence`: at most six results from one page, concurrency 1, no retries, and a 30-second request timeout. These form prefills do not change programmatic defaults or add a hidden query to batch-only input. A successful preview does not by itself validate multi-query interleaving or pagination.

```json
{
  "query": "artificial intelligence",
  "queries": ["robotics"],
  "maxItems": 20,
  "maxItemsPerQuery": 10,
  "maxPages": 2,
  "region": "us-en",
  "safeSearch": "moderate",
  "timeRange": "",
  "maxConcurrency": 2,
  "proxyConfiguration": { "useApifyProxy": false }
}
```

### Reliability and limits

The Actor validates response status and content type before parsing, validates pagination actions, uses stable per-query cookie/proxy sessions, spaces request starts to avoid bursts, retries only temporary failures with bounded backoff, and fails closed on CAPTCHA or human-verification pages. It never solves or bypasses a CAPTCHA.

DuckDuckGo controls ranking, inventory, and which optional attributes appear. `maxItems` is a cap, so a run may return fewer records when the requested page limit or source inventory is exhausted.

# Changelog

This Actor's version history is a separate document: https://apify.com/searchapi/duckduckgo-search-scraper/changelog.md

# Actor input Schema

## `query` (type: `string`):

The main keywords to search on DuckDuckGo.

## `queries` (type: `array`):

Optional additional queries. Results are interleaved fairly across all unique queries.

## `maxItems` (type: `integer`):

Global cap across all queries.

## `maxItemsPerQuery` (type: `integer`):

Per-query cap before the global fair-interleaving limit is applied.

## `maxPages` (type: `integer`):

Bounded DuckDuckGo continuation pages to request for each query.

## `region` (type: `string`):

DuckDuckGo country-language code, such as us-en, uk-en, in-en, or de-de.

## `safeSearch` (type: `string`):

DuckDuckGo Safe Search level to send with every page request.

## `timeRange` (type: `string`):

DuckDuckGo date filter: any time, past day, week, month, or year.

## `maxConcurrency` (type: `integer`):

Maximum number of independent queries processed concurrently.

## `maxRequestRetries` (type: `integer`):

Retries only temporary network, rate-limit, and 5xx failures. CAPTCHA responses are not retried.

## `requestTimeoutSecs` (type: `integer`):

Maximum time for each DuckDuckGo HTTP request.

## `proxyConfiguration` (type: `object`):

Optional authorized Residential or custom proxy. GOOGLE_SERP is not compatible with DuckDuckGo.

## Actor input object example

```json
{
  "query": "artificial intelligence",
  "maxItems": 6,
  "maxItemsPerQuery": 6,
  "maxPages": 1,
  "region": "us-en",
  "safeSearch": "moderate",
  "timeRange": "",
  "maxConcurrency": 1,
  "maxRequestRetries": 2,
  "requestTimeoutSecs": 30,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "artificial intelligence",
    "maxItems": 6,
    "maxItemsPerQuery": 6,
    "maxPages": 1,
    "maxConcurrency": 1,
    "maxRequestRetries": 0,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("searchapi/duckduckgo-search-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "query": "artificial intelligence",
    "maxItems": 6,
    "maxItemsPerQuery": 6,
    "maxPages": 1,
    "maxConcurrency": 1,
    "maxRequestRetries": 0,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("searchapi/duckduckgo-search-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "artificial intelligence",
  "maxItems": 6,
  "maxItemsPerQuery": 6,
  "maxPages": 1,
  "maxConcurrency": 1,
  "maxRequestRetries": 0,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call searchapi/duckduckgo-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,searchapi/duckduckgo-search-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/SVqnDIVwh4T82ci3N/builds/IELmSX1jR2aMaeRPt/openapi.json
