{
  "openapi": "3.0.1",
  "info": {
    "title": "Baidu Search Scraper By Site & File Type",
    "description": "Baidu Search Scraper extracts search results by site and file type, including titles, URLs, snippets, domains, rankings, and document links. Ideal for SEO research, competitor analysis, content discovery, SERP monitoring, and search intelligence.",
    "version": "0.1",
    "x-build-id": "7P6TTNQ5QKcgfMOdt"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/simpleapi~baidu-search-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-simpleapi-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/simpleapi~baidu-search-scraper/runs": {
      "post": {
        "operationId": "runs-sync-simpleapi-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/simpleapi~baidu-search-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-simpleapi-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. Site/file-type/phrase filters below are appended to each term automatically.",
            "items": {
              "type": "string"
            }
          },
          "sites": {
            "title": "🌐 Restrict To Sites",
            "type": "array",
            "description": "🏷️ **Site restriction.** One or more domains (e.g. zhihu.com, csdn.net). OR-combined into the query as (site:a.com OR site:b.com) so results come only from these domains. Leave empty for no restriction (whole web).",
            "items": {
              "type": "string"
            }
          },
          "fileType": {
            "title": "📄 File Type",
            "enum": [
              "any",
              "pdf",
              "doc",
              "xls",
              "ppt",
              "rtf"
            ],
            "type": "string",
            "description": "📎 Restrict results to a document type via Baidu's filetype: operator. \"any\" = no restriction (default).",
            "default": "any"
          },
          "exactPhrase": {
            "title": "💬 Exact Phrase Match",
            "type": "string",
            "description": "🔒 Wraps this phrase in quotes and appends it to every query so Baidu matches it verbatim (e.g. \"machine learning tutorial\"). Leave empty to skip.",
            "default": ""
          },
          "excludeWords": {
            "title": "🚫 Exclude Words",
            "type": "array",
            "description": "➖ Words/phrases to exclude from results. Each entry is appended as -word so Baidu drops pages containing it. Leave empty for no exclusions.",
            "items": {
              "type": "string"
            }
          },
          "titleOnly": {
            "title": "🏷️ Title-Only Match",
            "type": "boolean",
            "description": "🔍 When ON, also appends intitle:<query> so Baidu favors pages with the search term in the page title. Default OFF (matches anywhere on the page).",
            "default": false
          },
          "targetDomain": {
            "title": "🎯 Flag Own-Domain Matches",
            "type": "string",
            "description": "🏠 Enter your own domain (e.g. mybrand.com) to have every result row flagged with matchesTargetDomain=true/false depending on whether its resolved link belongs to this domain. Leave empty to skip the check (field stays null).",
            "default": ""
          },
          "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). Also sent as Baidu's rn= param on this variant so the page density actually follows this setting. 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}