SerpApi (预览版)
通过 SerpApi 实时搜索引擎结果。 在没有管理代理、CAPTCHA 或分析器的情况下,刮掉 Google、必应、YouTube、Google 学者等。 SerpApi 处理基础结构,以便工作流接收干净的结构化 JSON。
此连接器在以下产品和区域中可用:
| Service | Class | Regions |
|---|---|---|
| Copilot Studio | 高级 | 除以下各项外的所有 Power Automate 区域: - 美国政府 (GCC) - 美国政府 (GCC High) - 由世纪互联运营的中国云 - 美国国防部(DoD) |
| 逻辑应用程序 | 标准 | 除以下各项外的所有 逻辑应用区域 : - Azure 政府区域 - Azure 中国区域 - 美国国防部(DoD) |
| Power Apps | 高级 | 除以下各项外的所有 Power Apps 区域 : - 美国政府 (GCC) - 美国政府 (GCC High) - 由世纪互联运营的中国云 - 美国国防部(DoD) |
| Power Automate | 高级 | 除以下各项外的所有 Power Automate 区域: - 美国政府 (GCC) - 美国政府 (GCC High) - 由世纪互联运营的中国云 - 美国国防部(DoD) |
| 联系人 | |
|---|---|
| Name | SerpApi |
| URL | https://serpapi.com |
| support@serpapi.com |
| 连接器元数据 | |
|---|---|
| Publisher | SerpApi |
| 网站 | https://serpapi.com |
| 隐私策略 | https://serpapi.com/legal/privacy |
| Categories | 网站;商业智能 |
SerpApi
SerpApi 是一个实时搜索引擎结果 API。 它处理代理、CAPTCHA 和分析,以便Power Apps和Power Automate流接收干净、结构化的 JSON,而无需管理任何擦除基础结构。
Publisher:SerpApi
Prerequisites
- SerpApi 帐户。 在 serpapi.com 注册。
- 有效的 SerpApi API 密钥。 免费计划包括每月 250 次搜索。 付费计划可用于更高的数量。
支持的作
谷歌搜索 (GoogleSearch)
检索给定查询的结构化 Google 搜索结果。 返回有机结果、广告、知识图条目、相关问题、本地结果、热门故事等。 返回的确切字段取决于查询及其显示的内容。
获取位置 (GetLocations)
返回可传递给 location 搜索参数的受支持地理位置的列表。 使用此函数在运行搜索之前查找城市或区域的确切位置字符串。
获取帐户信息 (GetAccount)
返回有关 SerpApi 帐户的信息,包括当前计划、每月搜索配额、剩余搜索和每小时使用情况统计信息。
获取凭据
- 在 serpapi.com 登录到 SerpApi 帐户。
- 导航到 serpapi.com/manage-api-key。
- 复制 API 密钥。
- 在Power Apps或Power Automate中创建连接时,请将 API 密钥粘贴到 API 密钥字段中。
API 密钥由 Power Platform 安全地存储,并自动注入到每个请求中。 设置连接后,无需再次提供它。
入门
基本用法
该 GoogleSearch 操作采用一个必需参数(搜索查询)和附加参数的可选记录:
Set(varJsonResponse, SerpApi.GoogleSearch("coffee"))
若要在用于调试的 HTML 文本控件中显示原始 JSON 响应,请执行以下操作:
$"<pre>{JSON(varJsonResponse, JSONFormat.IndentFour)}</pre>"
传递可选参数
可选参数作为记录传递(第二个参数)。 仅包括要设置的参数 - 省略密钥不会为该参数发送任何内容,让 SerpApi 使用自己的默认值。
在下面的示例中,输入类型和名称是建议,而不是强制性的。
Set(varJsonResponse, SerpApi.GoogleSearch(
searchQueryInput.Text,
{
location: locationInput.Text,
gl: glInput.Text,
hl: hlInput.Text,
lat: latInput.Text,
lon: lonInput.Text,
radius: radiusInput.Text,
uule: uuleInput.Text,
google_domain: googleDomainInput.Text,
cr: crInput.Text,
lr: lrInput.Text,
tbs: tbsInput.Text,
nfpr: nfprCheckbox.Value,
filter: filterCheckbox.Value,
safe: safeDropdown.Selected.Value,
device: deviceDropdown.Selected.Value,
tbm: tbmDropdown.Selected.Value,
start: startInput.Text,
ludocid: ludocidInput.Text,
lsig: lsigInput.Text,
kgmid: kgmidInput.Text,
si: siInput.Text,
ibp: ibpInput.Text,
uds: udsInput.Text,
no_cache: noCacheCheckbox.Value
}
))
控件类型映射:
| 参数类型 | 建议的Power Apps控件 | 值引用 |
|---|---|---|
| 文本 (字符串) | 文本输入 | controlName.Text |
| 布尔 | 切换或复选框 | controlName.Value |
| 枚举(固定选项) | 下拉列表 | controlName.Selected.Value |
| 编号 | 文本输入 | controlName.Text |
访问响应数据
响应是 JSON 对象。 直接从变量外访问顶级属性:
varJsonResponse.search_information.total_results
将库绑定到有机结果:
varJsonResponse.organic_results
将库绑定到本地业务结果:
varJsonResponse.local_results.places
有关响应字段的完整列表,请参阅 SerpApi Google Search 文档 。
查找有效的位置字符串
用于 GetLocations 查找要传递给 GoogleSearch的确切位置名称。 参数 q 按城市或区域名称筛选,并 limit 限制返回的结果数。
Set(varLocations, SerpApi.GetLocations("Austin", {limit: 5}))
将结果绑定到库:
varLocations
集合中的每个项都有name、、canonical_namecountry_code、target_type、和reachgps字段。 在后续GoogleSearch调用中将canonical_name值作为location参数传递:
Set(varResults, SerpApi.GoogleSearch(
"coffee shops",
{location: locationGallery.Selected.canonical_name}
))
检查帐户使用情况
用于 GetAccount 检索当前的计划详细信息和配额使用情况。 这对于在达到每月限制之前检查剩余的搜索数非常有用。
Set(varAccount, SerpApi.GetAccount())
从响应中访问单个字段:
varAccount.plan_searches_left
varAccount.this_month_usage
varAccount.account_rate_limit_per_hour
有关响应字段的完整列表,请参阅 SerpApi 帐户 API 文档 。
已知问题和限制
- 可变响应结构:Google 搜索响应中存在的字段取决于查询以及 Google 为其返回的内容。 并非所有字段都出现在每个响应中。 有关可能的响应字段的完整说明,请参阅 SerpApi Google Search 文档 。
-
速率限制:请求受 SerpApi 计划的每月配额和每小时速率限制的约束。 超过任一
429项将导致错误响应。 -
缓存的结果:默认情况下,SerpApi 为特定于每个用户的重复请求(最多 1 小时)提供其缓存的结果。 使用
no_cache参数强制新结果。 请注意,缓存的搜索不计入每月配额。
支持
有关此连接器或 SerpApi 帐户的帮助,请联系 SerpApi 支持团队:
- Email:contact@serpapi.com
- 实时聊天: serpapi.com 提供 24/7,你可以与 SerpApi 支持团队的成员直接交谈。
正在创建连接
连接器支持以下身份验证类型:
| 默认 | 用于创建连接的参数。 | 所有区域 | 不可共享 |
违约
适用:所有区域
用于创建连接的参数。
这是不可共享的连接。 如果 Power App 与另一个用户共享,系统会提示其他用户显式创建新连接。
| Name | 类型 | Description | Required |
|---|---|---|---|
| API 密钥 | 安全字符串 | SerpApi API 密钥。 在 https://serpapi.com/manage-api-key | True |
操作
| Google 搜索 |
检索给定查询的结构化 Google 搜索结果。 返回有机结果、广告、知识图、相关问题、热门故事、本地结果等。 |
| 获取位置 |
返回可用于搜索中位置参数的受支持地理位置的列表。 用于查找城市或区域的确切位置字符串。 |
| 获取帐户信息 |
返回有关经过身份验证的 SerpApi 帐户的信息,包括计划详细信息、剩余搜索和使用情况统计信息。 |
Google 搜索
检索给定查询的结构化 Google 搜索结果。 返回有机结果、广告、知识图、相关问题、热门故事、本地结果等。
参数
| 名称 | 密钥 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
搜索查询
|
q | True | string |
搜索查询。 支持所有标准运算符(例如 site:、inurl:、intitle:)和高级参数,例如as_dt和as_eq。 |
|
Location
|
location | string |
搜索源自的位置。 在城市级别指定,以获得最佳准确性(例如德克萨斯州奥斯汀)。 不能与 uule、lat 或 lon 参数一起使用。 有关支持的位置,请参阅 https://serpapi.com/locations-api 。 |
|
|
编码位置 (UULE)
|
uule | string |
Google 的编码位置字符串。 用作精确地理位置的位置参数的替代方法。 不能与位置、lat、lon 或 radius 一起使用。 |
|
|
纬度
|
lat | number |
搜索源的 GPS 纬度。 使用 lon 参数时是必需的。 不能与位置或 uule 一起使用。 |
|
|
经度
|
lon | number |
搜索源的 GPS 经度。 使用 lat 参数时是必需的。 不能与位置或 uule 一起使用。 |
|
|
半径(米)
|
radius | integer |
偏差搜索结果的距离(以米为单位)。 此区域中的结果排名更高。 可以与位置或 lat/lon 一起使用。 最大半径:桌面上 199 米;平板电脑或移动设备上的 1000 米。 不能与 uule 一起使用。 |
|
|
Google 域
|
google_domain | string |
要使用的 Google 域(例如 google.com、google.co.uk、google.fr)。 默认为 google.com。 请参阅 https://serpapi.com/google-domains 完整列表。 |
|
|
国家
|
gl | string |
搜索的双字母国家/地区代码(例如,us、gb、fr、de)。 请参阅 https://serpapi.com/google-countries 完整列表。 |
|
|
语言
|
hl | string |
双字母界面语言代码(例如 en、es、fr、de)。 请参阅 https://serpapi.com/google-languages 完整列表。 |
|
|
国家/地区限制
|
cr | string |
将结果限制为源自特定国家/地区的文档。 将国家/地区{CODE} 格式与 | 配合使用作为分隔符(例如 countryFR|countryDE)。 |
|
|
语言限制
|
lr | string |
将结果限制为特定语言。 将 lang_{code} 格式用于 |作为分隔符(例如lang_fr|lang_de)。 |
|
|
高级搜索筛选器
|
tbs | string |
高级搜索筛选器(要搜索)。 启用按日期范围、内容类型等进行筛选(例如,过去一天的 qdr:d、qdr:w 表示过去一周)。 |
|
|
SafeSearch
|
safe | string |
成人内容筛选级别。 设置为“活动”以启用筛选,或将其禁用。 |
|
|
排除自动更正的结果
|
nfpr | integer |
如果原始查询拼写错误,则设置为 1 以排除自动更正查询的结果。 设置为 0 以包含它们(默认值)。 |
|
|
重复内容筛选器
|
filter | integer |
控制类似结果和省略的结果筛选器。 设置为 1 以启用(默认值)或 0 以禁用。 |
|
|
搜索类型
|
tbm | string |
要执行的 Google 搜索类型(要匹配)。 省略常规 Web 搜索。 |
|
|
结果偏移量
|
start | integer |
分页偏移量。 跳过给定的结果数。 0 返回第一页,10 返回第二页等。 |
|
|
Device
|
device | string |
要模拟的设备类型。 使用桌面(默认)、平板电脑或移动设备。 |
|
|
绕过缓存
|
no_cache | boolean |
设置为 true 以强制新结果,绕过 SerpApi 的 1 小时缓存。 缓存的搜索是免费的,不计入每月配额。 请勿与异步一起使用。 |
|
|
异步模式
|
async | boolean |
设置为 true 以稍后通过搜索存档 API 提交搜索和检索结果,而不是同步等待结果。 请勿与no_cache一起使用。 |
|
|
输出格式
|
output | string |
输出格式。 对于结构化 JSON,设置为 json(默认值),或原始 HTML 的 html。 使用 html 进行调试或尚未完全支持的结果类型。 |
|
|
放置 CID
|
ludocid | string |
特定地点的 Google CID (客户标识符)。 在本地结果中找到place_id。 用于检索位置的知识图。 |
|
|
知识图 ID
|
kgmid | string |
Google Knowledge Graph 实体的 KGMID。 可以替代除 start 以外的其他搜索参数。 |
|
|
本地签名 (lsig)
|
lsig | string |
用于强制本地位置的知识图地图视图。 通过本地包 API 或 Google 本地 API 获取。 |
|
|
缓存搜索参数 (si)
|
si | string |
知识图选项卡的缓存加密搜索参数。 可以替代除 start 以外的其他搜索参数。 |
|
|
布局扩展 (ibp)
|
ibp | string |
控制 Google 结果中的布局扩展(例如 gwp;0,7). |
|
|
筛选器字符串 (uds)
|
uds | string |
Google 提供的筛选字符串用于结果筛选。 |
|
|
零跟踪
|
zero_trace | boolean |
仅限企业帐户。 设置为 true 以跳过搜索参数和元数据的服务器端存储。 |
返回
| 名称 | 路径 | 类型 | 说明 |
|---|---|---|---|
|
search_metadata
|
search_metadata | object |
有关搜索请求的元数据,包括状态、计时和 SerpApi 标识符。 |
|
search_parameters
|
search_parameters | object |
用于此搜索的参数,从请求中回显。 |
|
search_information
|
search_information | object |
有关搜索的高级信息,例如总结果计数和花费的时间。 |
|
organic_results
|
organic_results | array of object |
Google 返回的标准有机 Web 结果。 |
|
items
|
organic_results | object | |
|
广告
|
ads | array of object |
高于或低于有机结果的付费广告。 |
|
items
|
ads | object | |
|
knowledge_graph
|
knowledge_graph | object |
Google Knowledge Graph 面板数据(如果为查询存在)。 |
|
related_questions
|
related_questions | array of object |
人员还询问与查询相关的问题。 |
|
items
|
related_questions | object | |
|
related_searches
|
related_searches | array of object |
结果页底部显示的相关搜索建议。 |
|
items
|
related_searches | object | |
|
local_results
|
local_results | object |
本地包结果,当查询具有本地意向时显示。 |
|
top_stories
|
top_stories | array of object |
与查询相关的热门新闻报道。 |
|
items
|
top_stories | object | |
|
分页
|
pagination | object |
指向下一页和上一页结果的链接。 |
获取位置
返回可用于搜索中位置参数的受支持地理位置的列表。 用于查找城市或区域的确切位置字符串。
参数
| 名称 | 密钥 | 必需 | 类型 | 说明 |
|---|---|---|---|---|
|
搜索词
|
q | string |
用于筛选可用位置列表(例如奥斯汀)的城市或区域名称。 |
|
|
限度
|
limit | integer |
要返回的最大位置数。 |
返回
获取帐户信息
定义
Location
支持用于位置搜索参数的地理位置。
| 名称 | 路径 | 类型 | 说明 |
|---|---|---|---|
|
id
|
id | string |
此位置的唯一标识符。 |
|
名字
|
name | string |
位置的完整名称(例如德克萨斯州奥斯汀,美国)。 |
|
canonical_name
|
canonical_name | string |
位置参数中使用的规范名称。 |
|
country_code
|
country_code | string |
双字母 ISO 国家/地区代码。 |
|
target_type
|
target_type | string |
位置类型(例如城市、DMA 区域、国家/地区)。 |
|
市场宣传
|
reach | integer |
此位置的每月搜索量估计达到。 |
|
gps
|
gps | array of number |
GPS 坐标为 [纬度, 经度]。 |
账户信息
有关经过身份验证的 SerpApi 帐户的信息。
| 名称 | 路径 | 类型 | 说明 |
|---|---|---|---|
|
account_id
|
account_id | string |
帐户的唯一标识符。 |
|
API密钥
|
api_key | string |
此帐户的 API 密钥。 |
|
account_email
|
account_email | string |
与帐户关联的电子邮件地址。 |
|
plan_name
|
plan_name | string |
当前订阅计划的名称。 |
|
plan_monthly_price
|
plan_monthly_price | number |
当前计划的每月价格(以美元为单位)。 |
|
searches_per_month
|
searches_per_month | integer |
当前计划中每月包含的搜索总数。 |
|
plan_searches_left
|
plan_searches_left | integer |
当前计费周期中剩余的搜索数。 |
|
extra_credits
|
extra_credits | integer |
在计划外部购买的其他搜索额度。 |
|
account_rate_limit_per_hour
|
account_rate_limit_per_hour | integer |
每小时允许的最大 API 请求数。 |
|
this_month_usage
|
this_month_usage | integer |
此计费周期到目前为止使用的搜索数。 |
|
this_hour_searches
|
this_hour_searches | integer |
当前小时内进行的搜索数。 |
|
last_hour_searches
|
last_hour_searches | integer |
在上一小时内进行的搜索数。 |