SerpAPI Search
Search Google via SerpAPI with country/language targeting.
Quick start
CODEBLOCK0
Engines
| Engine | Use case | Key results field |
|---|
| INLINECODE0 | Web search (default) | INLINECODE1 |
| INLINECODE2 |
News articles |
news_results |
|
google_local | Local businesses/places |
local_results |
Options
| Flag | Description | Default |
|---|
| INLINECODE6 | INLINECODE7 , google_news, INLINECODE9 | INLINECODE10 |
| INLINECODE11 |
2-letter country code (
br,
us,
de, etc.) |
us |
|
--lang | Language code (
pt,
en,
es, etc.) |
en |
|
--location | Location string (e.g.
"São Paulo, Brazil") | — |
|
--num | Number of results |
10 |
|
--json | Raw JSON output | off |
API key
Set SERPAPI_API_KEY env var, or store it:
CODEBLOCK1
Common country codes
INLINECODE27 (Brazil), us (USA), pt (Portugal), de (Germany), fr (France), es (Spain), gb (UK), jp (Japan), in (India).
SerpAPI 搜索
通过 SerpAPI 进行谷歌搜索,支持国家/语言定向。
快速开始
bash
谷歌搜索
{baseDir}/scripts/search.sh 人工智能 B2B --country br --lang pt
谷歌新闻
{baseDir}/scripts/search.sh inteligência artificial --engine google_news --country br --lang pt
谷歌本地
{baseDir}/scripts/search.sh AI 公司 --engine google_local --country us --location San Francisco, California
搜索引擎
| 引擎 | 用途 | 关键结果字段 |
|---|
| google | 网页搜索(默认) | organicresults |
| googlenews |
新闻文章 | news_results |
| google
local | 本地商家/地点 | localresults |
选项
| 标志 | 描述 | 默认值 |
|---|
| --engine | google、googlenews、googlelocal | google |
| --country |
两位国家代码(br、us、de 等) | us |
| --lang | 语言代码(pt、en、es 等) | en |
| --location | 位置字符串(例如 São Paulo, Brazil) | — |
| --num | 结果数量 | 10 |
| --json | 原始 JSON 输出 | 关闭 |
API 密钥
设置 SERPAPIAPIKEY 环境变量,或存储它:
bash
mkdir -p ~/.config/serpapi
echo yourkeyhere > ~/.config/serpapi/api_key
chmod 600 ~/.config/serpapi/api_key
常用国家代码
br(巴西)、us(美国)、pt(葡萄牙)、de(德国)、fr(法国)、es(西班牙)、gb(英国)、jp(日本)、in(印度)。