{
  "openapi": "3.0.1",
  "info": {
    "title": "🔍 Baidu Search Scraper",
    "description": "Scrape Baidu search results at scale. Extract organic listings, answer boxes, related videos, related searches, and top searches. Supports bulk queries, proxy fallback, date filters, and device/language options for SEO and market research.",
    "version": "0.1",
    "x-build-id": "zzOrHGBRETh69VLlE"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scraper-engine~baidu-search-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scraper-engine-baidu-search-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/scraper-engine~baidu-search-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scraper-engine-baidu-search-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/scraper-engine~baidu-search-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scraper-engine-baidu-search-scraper",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "urls"
        ],
        "properties": {
          "urls": {
            "title": "🔎 Search Queries (required)",
            "type": "array",
            "description": "📝 **What to enter:** Baidu search URLs (e.g. https://www.baidu.com/s?wd=python) OR plain search terms (e.g. python tutorial, machine learning). Add one per line for bulk scraping.\n\n💡 **Tip:** Use plain terms for simplicity. URLs are parsed automatically to extract the query.",
            "items": {
              "type": "string"
            }
          },
          "deviceType": {
            "title": "📱 Device Type",
            "enum": [
              "desktop",
              "mobile",
              "tablet"
            ],
            "type": "string",
            "description": "🖥️ **Desktop** = www.baidu.com (default). 📱 **Mobile/Tablet** = m.baidu.com. Use to scrape mobile vs desktop SERP (different layouts & results).",
            "default": "desktop"
          },
          "languageLocalization": {
            "title": "🌐 Language",
            "minimum": 1,
            "maximum": 3,
            "type": "integer",
            "description": "1 = All languages (default). 2 = Simplified Chinese (简体中文). 3 = Traditional Chinese (繁體中文). Affects search result language/region.",
            "default": 1
          },
          "startPage": {
            "title": "📄 Starting Page",
            "minimum": 1,
            "type": "integer",
            "description": "Page number to start scraping from. 1 = first page (default). Use 2+ to skip earlier pages (e.g. for pagination continuation).",
            "default": 1
          },
          "numResults": {
            "title": "📊 Results Per Page",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Number of results per page (1–50). Baidu typically shows 10. Higher = more results per request. Use with maxPagination for total result cap.",
            "default": 10
          },
          "timePeriod": {
            "title": "📅 Time Period Filter",
            "type": "object",
            "description": "Optional date range filter. Leave empty for no filter (all results). Use Start Date + End Date for custom range, OR Days Ago for \"last N days\" (e.g. 7 = last week).",
            "properties": {
              "startDate": {
                "title": "📆 Start Date",
                "type": "string",
                "editor": "datepicker",
                "description": "From date (YYYY-MM-DD). Used with End Date for custom range. Ignored if Days Ago is set.",
                "default": ""
              },
              "endDate": {
                "title": "📆 End Date",
                "type": "string",
                "editor": "datepicker",
                "description": "To date (YYYY-MM-DD). Used with Start Date for custom range. Ignored if Days Ago is set.",
                "default": ""
              },
              "daysAgo": {
                "title": "⏱️ Days Ago",
                "type": "integer",
                "description": "Alternative: filter to last N days. e.g. 7 = last week, 30 = last month. Set to 0 to disable (use Start/End dates or no filter).",
                "minimum": 0,
                "default": 0
              }
            }
          },
          "maxPagination": {
            "title": "📑 Maximum Pages",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Max pages to scrape per query. 0 = no limit (capped at 10). 3 = first 3 pages. More pages = more results but longer run time.",
            "default": 3
          },
          "outputFile": {
            "title": "💾 Output File",
            "type": "string",
            "description": "Optional custom key for key-value store. Results are always saved to Apify dataset. If set, also saves to KVS with this name for easy retrieval.",
            "default": ""
          },
          "proxyConfiguration": {
            "title": "🔒 Proxy Configuration",
            "type": "object",
            "description": "By default: no proxy. If Baidu blocks → datacenter → residential (3 retries). Enable Apify proxy here if you want to start with proxy. Fallback still applies when blocked."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}