集成 SerpBase Google 网页、图片、新闻和视频 API 所需的一切。
请在 X-API-Key 请求头中传入你的 API key。
curl -X POST https://api.serpbase.dev/google/search -H "Content-Type: application/json" -H "X-API-Key: your_api_key" -d '{
"q": "python asyncio",
"hl": "en",
"gl": "us",
"page": 1
}'/google/searchDefault Google search results with organic links and rich SERP modules.
/google/imagesGoogle Images results with image URLs, thumbnails, and source domains.
/google/newsGoogle News results with publisher, time, snippet, and thumbnail when available.
/google/videosGoogle Videos results with source, channel, duration, and thumbnails.
q必填stringhlstringglstringpagenumber四个端点都接受相同的请求体。端点本身决定返回的结果类型。
所有搜索端点都返回 HTTP 200。请使用 status 字段判断业务是否成功。
statusnumberBusiness status code. `0` means success.
search_typestringResolved response type: `search`, `images`, `news`, or `videos`.
querystringNormalized query string from the request.
pagenumberCurrent page number.
session_idstringWorker session identifier used to serve the request.
elapsed_msnumberTotal request duration in milliseconds.
organicOrganicResult[]?Web-only organic results.
imagesImageResult[]?Image search results.
newsNewsResult[]?News search results.
videosVideoResult[]?Video search results.
top_storiesTopStory[]?Top stories module on web SERPs.
people_also_askPAA[]?People Also Ask data on web SERPs.
knowledge_graphKnowledgeGraph?Knowledge panel data on web SERPs.
related_searchesstring[]?Related searches on web SERPs.
curl -X POST https://api.serpbase.dev/google/search -H "Content-Type: application/json" -H "X-API-Key: your_api_key" -d '{
"q": "python asyncio",
"hl": "en",
"gl": "us",
"page": 1
}'{
"status": 0,
"search_type": "search",
"query": "python asyncio",
"page": 1,
"organic": [
{
"rank": 1,
"title": "Async IO in Python",
"link": "https://realpython.com/async-io-python/",
"display_link": "realpython.com",
"snippet": "A practical guide to asyncio in Python..."
}
],
"people_also_ask": [
{
"question": "What is asyncio in Python?",
"answer": "asyncio is Python's asynchronous I/O framework...",
"title": "asyncio docs",
"link": "https://docs.python.org/3/library/asyncio.html"
}
],
"session_id": "7f2e5a8c4b",
"elapsed_ms": 423
}curl -X POST https://api.serpbase.dev/google/images -H "Content-Type: application/json" -H "X-API-Key: your_api_key" -d '{"q":"iphone 15 pro blue","hl":"en","gl":"us","page":1}'{
"status": 0,
"search_type": "images",
"query": "iphone 15 pro blue",
"page": 1,
"images": [
{
"title": "iPhone 15 Pro blue",
"link": "https://store.example.com/iphone-15-pro-blue",
"image_url": "https://img.example.com/iphone-blue.jpg",
"thumbnail_url": "https://img.example.com/iphone-blue-thumb.jpg",
"source": "Store Example",
"domain": "store.example.com"
}
],
"session_id": "7f2e5a8c4b",
"elapsed_ms": 388
}{
"status": 0,
"search_type": "news",
"query": "apple event",
"page": 1,
"news": [
{
"title": "Apple announces new chips at spring event",
"link": "https://www.theverge.com/apple-launch-event",
"source": "The Verge",
"time": "Apr 9, 2026",
"snippet": "Apple used the event to introduce faster laptop and desktop silicon.",
"thumbnail_url": "https://cdn.theverge.com/apple-event.jpg"
}
],
"session_id": "7f2e5a8c4b",
"elapsed_ms": 401
}{
"status": 0,
"search_type": "videos",
"query": "python asyncio tutorial",
"page": 1,
"videos": [
{
"title": "Python asyncio tutorial for beginners",
"link": "https://www.youtube.com/watch?v=abc123",
"source": "Corey Schafer",
"duration": "23:45",
"time": "1 week ago",
"thumbnail_url": "https://i.ytimg.com/vi/abc123/hqdefault.jpg"
}
],
"session_id": "7f2e5a8c4b",
"elapsed_ms": 417
}const response = await fetch("https://api.serpbase.dev/google/news", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "your_api_key",
},
body: JSON.stringify({ q: "apple event", gl: "us", hl: "en", page: 1 }),
});
const data = await response.json();
if (data.status !== 0) throw new Error(data.error || "search failed");
for (const item of data.news ?? []) {
console.log(item.source, item.title);
}