# Baidu Search

Returns Baidu News results with decoded URLs and text. When Baidu returns JSON, provider_response is unchanged. When results are extracted from HTML, provider_response.format is adapted_news_html and provider_response.feed is a compatibility representation, not an untouched provider payload. results always contains the same entries as provider_response.feed.entry. Entries retain title, url, urlEnc, source, category, abs, imgUrl, time and pn; raw_result additionally preserves the extracted source record. For adapted entries, pn is the one-based position across pages, urlEnc is the encoded URL, and category describes the news search query. time is null when no exact publication timestamp is available; date may contain Baidu's relative publication text. Feed metadata retains requestUrl (the fetched URL), category, resultnum (the returned entry count as a string), and all (null when the total is unknown, or "0" for an explicit no-result page). No timestamps or total counts are guessed.

- **Documentation:** [https://staging.scrappa.co/docs/baidu-api/baidu_search](https://staging.scrappa.co/docs/baidu-api/baidu_search)
- **API group:** Baidu API
- **Endpoint:** `GET https://scrappa.co/api/baidu/search`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | string | Yes | Search query. |
| `page` | integer | No | Page number from 1 to 50. Default: 1. |
| `limit` | integer | No | Results requested per page from 1 to 50. Default: 10. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/baidu/search?query=artificial+intelligence&page=1&limit=10"
```

## Example response

```json
{
    "search_parameters": {
        "engine": "baidu_search",
        "query": "artificial intelligence",
        "page": "1",
        "limit": "10"
    },
    "organic_results": [
        {
            "position": 1,
            "result_type": "organic",
            "title": "Artificial Intelligence Research",
            "title_highlighted_words": [],
            "link": "https://example.com/ai",
            "displayed_link": "example.com",
            "snippet": "The latest artificial intelligence research.",
            "snippet_highlighted_words": [],
            "source": "Example News",
            "category": "artificial intelligence",
            "category_label": "\u767e\u5ea6\u65b0\u95fb\u641c\u7d22",
            "date": "6\u5929\u524d",
            "timestamp": null,
            "thumbnail": "https://example.com/ai.jpg"
        }
    ],
    "special_results": [],
    "search_information": {
        "requestUrl": "https://www.baidu.com/s?word=artificial%20intelligence&rn=10&pn=0&tn=news&rtt=1&ie=utf-8",
        "category": {
            "label": "\u767e\u5ea6\u65b0\u95fb\u641c\u7d22",
            "value": "artificial intelligence"
        },
        "all": null,
        "resultnum": "1",
        "source": "baidu_news",
        "query_displayed": "artificial intelligence",
        "total_results": null,
        "total_results_is_estimate": false,
        "results_on_page": 1,
        "organic_results_on_page": 1,
        "upstream_result_count": 1,
        "page": 1,
        "limit": 10
    },
    "pagination": {
        "page": 1,
        "limit": 10,
        "results_on_page": 1,
        "total_results": null,
        "has_more": false,
        "next_page": null
    },
    "results": [
        {
            "title": "Artificial Intelligence Research",
            "url": "https://example.com/ai",
            "urlEnc": "https%3A%2F%2Fexample.com%2Fai",
            "source": "Example News",
            "category": {
                "label": "\u767e\u5ea6\u65b0\u95fb\u641c\u7d22",
                "value": "artificial intelligence"
            },
            "abs": "The latest artificial intelligence research.",
            "imgUrl": "https://example.com/ai.jpg",
            "time": null,
            "pn": 1,
            "date": "6\u5929\u524d",
            "raw_result": {
                "title": "Artificial Intelligence Research",
                "titleUrl": "https://example.com/ai",
                "summary": "The latest artificial intelligence research.",
                "sourceName": "Example News",
                "leftImgSrc": "https://example.com/ai.jpg",
                "dispTime": "6\u5929\u524d"
            }
        }
    ],
    "provider_response": {
        "format": "adapted_news_html",
        "feed": {
            "requestUrl": "https://www.baidu.com/s?word=artificial%20intelligence&rn=10&pn=0&tn=news&rtt=1&ie=utf-8",
            "category": {
                "label": "\u767e\u5ea6\u65b0\u95fb\u641c\u7d22",
                "value": "artificial intelligence"
            },
            "all": null,
            "resultnum": "1",
            "entry": [
                {
                    "title": "Artificial Intelligence Research",
                    "url": "https://example.com/ai",
                    "urlEnc": "https%3A%2F%2Fexample.com%2Fai",
                    "source": "Example News",
                    "category": {
                        "label": "\u767e\u5ea6\u65b0\u95fb\u641c\u7d22",
                        "value": "artificial intelligence"
                    },
                    "abs": "The latest artificial intelligence research.",
                    "imgUrl": "https://example.com/ai.jpg",
                    "time": null,
                    "pn": 1,
                    "date": "6\u5929\u524d",
                    "raw_result": {
                        "title": "Artificial Intelligence Research",
                        "titleUrl": "https://example.com/ai",
                        "summary": "The latest artificial intelligence research.",
                        "sourceName": "Example News",
                        "leftImgSrc": "https://example.com/ai.jpg",
                        "dispTime": "6\u5929\u524d"
                    }
                }
            ]
        }
    },
    "response_time_ms": 1200
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
| 503 | Upstream unavailable | Baidu could not be reached after safe retries. The request is not billed. |

## More Scrappa resources

- [API documentation](https://staging.scrappa.co/docs)
- [Full LLM-readable API reference](https://staging.scrappa.co/llms-full.txt)
- [OpenAPI specification](https://staging.scrappa.co/docs/api.json)
- [Pricing](https://staging.scrappa.co/pricing)
