Web Search API
Search the web using multiple search engines (Google, DuckDuckGo, Bing, Baidu) with advanced filtering, geographic targeting, and pagination support.
POST
/v1/web-search/*Google 搜索
POST
/v1/web-search/google通过 Google 搜索网页,支持高级搜索运算符、地理定位、语言过滤和分页。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
q | string | 必填 | 搜索关键词 |
location | string | 可选 | 地理位置,用于本地化结果 |
language | string | 可选 | 结果语言过滤 |
page | integer | 可选 (默认: 0) | 分页页码 |
num | integer | 可选 (默认: 10) | 每页结果数量 |
DuckDuckGo 搜索
POST
/v1/web-search/duckduckgo通过 DuckDuckGo 搜索网页,支持区域过滤、日期过滤和分页。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
q | string | 必填 | 搜索关键词 |
region | string | 可选 | 区域过滤 |
page | integer | 可选 (默认: 0) | 分页页码 |
Bing 搜索
POST
/v1/web-search/bing通过 Bing 搜索网页,支持市场定位、地理过滤、安全搜索和分页。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
q | string | 必填 | 搜索关键词 |
market | string | 可选 | 市场/区域定位 |
cc | string | 可选 | 国家代码过滤 |
page | integer | 可选 (默认: 0) | 分页页码 |
百度搜索
POST
/v1/web-search/baidu通过百度搜索网页,支持中文语言、分页和高级过滤。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
q | string | 必填 | 搜索关键词 |
page | integer | 可选 (默认: 0) | 分页页码 |
pn | integer | 可选 | 结果偏移量 |
响应
Response
{
"success": true,
"message": "Google web search completed successfully",
"data": {
"search_information": {
"total_results": 1250000
},
"organic_results": [
{
"title": "Large Language Models: A Survey",
"link": "https://example.com/llm-survey",
"snippet": "A comprehensive survey of large language models...",
"position": 1
}
],
"people_also_ask": [],
"relatedSearches": []
}
}示例
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://api.qinyanai.com"
# Google web search
response = requests.post(
f"{BASE_URL}/v1/web-search/google",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"q": "large language models survey", "num": 10}
)
# DuckDuckGo search
response = requests.post(
f"{BASE_URL}/v1/web-search/duckduckgo",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"q": "machine learning tutorial", "region": "us-en"}
)
# Bing search
response = requests.post(
f"{BASE_URL}/v1/web-search/bing",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"q": "deep learning", "market": "en-US"}
)
# Baidu search (Chinese)
response = requests.post(
f"{BASE_URL}/v1/web-search/baidu",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"q": "人工智能最新进展"}
)