SerpApi 호환 엔드포인트
SerpApi용으로 작성한 코드는 기본 URL만 바꾸면 동작합니다. engine 이름, 매개변수, 응답 필드는 같고 가격은 SerpBase 기준입니다.
전환 방법
https://serpapi.com/search.json을 아래 URL로 바꾸고 api_key에 SerpBase 키를 넣으세요. SerpApi처럼 GET 요청입니다. 키는 X-API-Key 헤더로도 보낼 수 있어 URL과 로그에 남지 않습니다.
BASH
curl "https://api.serpbase.dev/google/serpapi/search.json?engine=google&q=coffee&gl=us&hl=en" \
-H "X-API-Key: YOUR_API_KEY"
curl "https://api.serpbase.dev/google/serpapi/search.json?engine=amazon&k=headphones&amazon_domain=amazon.com" \
-H "X-API-Key: YOUR_API_KEY"PYTHON
import requests
res = requests.get(
"https://api.serpbase.dev/google/serpapi/search.json",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"engine": "google_news", "q": "semiconductors", "gl": "us"},
)
print(res.json()["news_results"][0]["title"])지원 engine
각 engine은 두 번째 열의 SerpBase 엔드포인트에서 실행되며 가격도 같습니다. 목록에 없는 engine은 400으로 거부됩니다.
| engine | 실행 엔드포인트 | 요청당 크레딧 |
|---|---|---|
google | Google Web Search | 1 |
google_images | Google Images Search | 1 |
google_news | Google News Search | 1 |
google_videos | Google Videos Search | 1 |
google_autocomplete | Google Search Autocomplete | 1 |
google_shopping | Google Shopping Search | 2 |
google_jobs | Google Jobs Search | 2 |
google_patents_details | Google Patent Details | 2 |
google_play | Google Play Search | 1 |
google_play_product | Google Play App Details | 1 |
google_trends | Google Trends | 2 |
google_trends_autocomplete | Google Trends Autocomplete | 2 |
google_trends_trending_now | Google Trends Trending Now | 2 |
google_maps | Google Maps Search | 2 |
google_maps_reviews | Google Maps Reviews | 2 |
duckduckgo | DuckDuckGo Search | 1 |
youtube | YouTube Search | 1 |
youtube_video_transcript | YouTube Video Transcripts | 2 |
amazon | Amazon Product Search | 2 |
amazon_product | Amazon Product Details | 2 |
amazon_autocomplete | Amazon Search Autocomplete | 1 |
walmart | Walmart Product Search | 2 |
walmart_product | Walmart Product Details | 2 |
ebay | eBay Product Search | 1 |
ebay_product | eBay Product Details | 2 |
apple_product | Apple Product Details | 1 |
SerpApi와 다른 점
- SerpBase가 추출한 필드를 SerpApi 이름으로 반환합니다. SerpBase에 없는 필드는 추측해 채우지 않고 생략하므로 읽기 전에 키가 있는지 확인하세요.
- 미지원: output=html(engine=google 제외), google_maps 장소 상세(/google/maps/detail 사용), TIMESERIES 외 google_trends data_type, apps 외 Play 스토어, SerpApi 계정·보관·비동기 API. no_cache, async, json_restrictor는 받지만 효과는 없습니다.
- 오류는 SerpApi와 같습니다. 거부된 요청은 400, 401, 429와 {"error": …}, 실행했지만 실패한 검색은 200과 search_metadata.status "Error"입니다. 실패한 검색은 과금되지 않습니다.