Google Image API Automation Skill
📖 Introduction
This skill provides users with one-click image data extraction directly from Google Images using the BrowserAct Google Image API template. It allows you to search with keywords, set country and language, control scroll depth and result limits, returning clean, structured image metadata directly via API.
✨ Features
- 1. No hallucinations, ensuring stable and accurate data extraction: Pre-set workflows avoid generative AI hallucinations.
- No CAPTCHA issues: No need to deal with reCAPTCHA or other verification challenges.
- No IP restrictions or geo-blocking: No need to handle regional IP limitations.
- Agile execution speed: Faster task execution compared to pure AI-driven browser automation solutions.
- High cost-effectiveness: Significantly reduces data acquisition costs compared to AI solutions that consume a large number of tokens.
🔑 API Key Guide
Before running, you must check the
BROWSERACT_API_KEY environment variable. If it is not set, do not take any further action; you should request and wait for the user to provide it collaboratively.
The Agent must inform the user at this point:
"Since you haven't configured the BrowserAct API Key yet, please go to the BrowserAct Console to get your Key first."
🛠️ Input Parameters
The Agent should flexibly configure the following parameters according to user needs when calling the script:
- 1. KeyWords (Search keywords)
-
Type:
string
-
Description: Search keywords used on Google Images.
-
Example:
flower,
ai agent, INLINECODE4
- 2. Country (Country or region bias)
-
Type:
string
-
Description: Country or region bias for results.
-
Supported values:
us,
gb,
ca,
au,
de,
fr,
es,
jp,
kr
-
Default: INLINECODE15
- 3. Language (UI language)
-
Type:
string
-
Description: UI language for the Google Images session and returned text.
-
Supported values:
en,
zh-CN,
zh-TW,
ja,
ko,
fr,
de,
es
-
Default: INLINECODE25
- 4. Scroll_count (Number of scroll actions)
-
Type:
number
-
Description: Number of scroll actions to load more image results.
-
Default: INLINECODE27
- 5. Datelimit (Maximum items)
-
Type:
number
-
Description: Maximum number of items to extract from the results list.
-
Default: INLINECODE29
🚀 Invocation (Recommended)
The Agent should execute the following independent script to achieve "results with one command":
CODEBLOCK0
⏳ Execution Status Monitoring
Since this task involves automated browser operations, it may take a considerable amount of time (several minutes). The script will
continuously output status logs with timestamps while running (e.g.,
[14:30:05] Task Status: running).
Agent Notice:
- - While waiting for the script to return results, please keep an eye on the terminal output.
- As long as the terminal is outputting new status logs, it means the task is running normally; do not mistake it for a deadlock or unresponsiveness.
- If the status remains unchanged for a long time or the script stops outputting without returning a result, then consider triggering the retry mechanism.
📊 Data Output
After successful execution, the script will parse and print the results directly from the API response. The results include:
- -
is_product: Whether the result is detected as a product-style listing - INLINECODE32 : Click-through URL associated with the result
- INLINECODE33 : Image result title or caption text
- INLINECODE34 : Source site logo URL
- INLINECODE35 : Source site name shown in results
- INLINECODE36 : Google Images related content identifier
- INLINECODE37 : Thumbnail image URL
- INLINECODE38 : Result index in the list
⚠️ Error Handling & Retry
During the execution of the script, if an error occurs (such as network fluctuation or task failure), the Agent should follow this logic:
- 1. Check the output:
- If the output
contains "Invalid authorization", it means the API Key is invalid or expired. In this case,
do not retry; guide the user to check and provide the correct API Key.
- If the output
does not contain "Invalid authorization" but the task execution fails (for example, the output starts with
Error: or the result is empty), the Agent should
automatically try executing the script one more time.
- 2. Retry limit:
- Automatic retry is limited to
once. If the second attempt still fails, stop retrying and report the specific error message to the user.
🌟 Typical Use Cases
- 1. Visual Content Sourcing: Finding specific imagery for creative research and design content.
- Competitor Asset Monitoring: Scanning Google Images for competitor product styles and logos.
- Market Visual Research: Building datasets of product listings across various countries.
- Localized Image Trends: Tracking what images appear for specific terms in Japan (
jp) or France (fr). - E-commerce Discovery: Extracting click-through links to track down where products are sold.
- Data Enrichment: Fetching thumbnails and high-level titles associated with keywords.
- Brand Tracking: Finding instances of specific brands appearing as image results.
- SEO Keyword Visualization: Checking the visual results that rank for chosen SEO keywords.
- Automated Content Aggregation: Delivering daily list-level visual metadata for specific topics.
- Global Image Search: Finding images related to global events or personalities in their native languages.
Google Image API 自动化技能
📖 简介
本技能通过 BrowserAct Google Image API 模板,为用户提供一键式从 Google 图片中提取数据的功能。它允许您使用关键词搜索、设置国家和语言、控制滚动深度和结果数量,并通过 API 直接返回清晰、结构化的图片元数据。
✨ 功能特点
- 1. 无幻觉,确保稳定准确的数据提取:预设工作流程避免了生成式 AI 的幻觉问题。
- 无验证码问题:无需处理 reCAPTCHA 或其他验证挑战。
- 无 IP 限制或地域封锁:无需处理区域 IP 限制。
- 执行速度快:相比纯 AI 驱动的浏览器自动化方案,任务执行速度更快。
- 高性价比:相比消耗大量 Token 的 AI 方案,显著降低数据获取成本。
🔑 API 密钥指南
运行前,必须检查 BROWSERACT
APIKEY 环境变量。如果未设置,请勿执行任何后续操作;应请求并等待用户协作提供。
此时 Agent 必须告知用户:
由于您尚未配置 BrowserAct API 密钥,请先前往 BrowserAct 控制台 获取您的密钥。
🛠️ 输入参数
Agent 在调用脚本时应根据用户需求灵活配置以下参数:
- 1. KeyWords(搜索关键词)
-
类型:string
-
描述:在 Google 图片上使用的搜索关键词。
-
示例:flower、ai agent、tesla
- 2. Country(国家或地区偏向)
-
类型:string
-
描述:结果的国家或地区偏向。
-
支持的值:us、gb、ca、au、de、fr、es、jp、kr
-
默认值:us
- 3. Language(界面语言)
-
类型:string
-
描述:Google 图片会话的界面语言及返回文本的语言。
-
支持的值:en、zh-CN、zh-TW、ja、ko、fr、de、es
-
默认值:en
- 4. Scroll_count(滚动次数)
-
类型:number
-
描述:加载更多图片结果的滚动操作次数。
-
默认值:5
- 5. Datelimit(最大条目数)
-
类型:number
-
描述:从结果列表中提取的最大条目数。
-
默认值:50
🚀 调用方式(推荐)
Agent 应执行以下独立脚本,实现一键获取结果:
bash
示例调用
python -u ./scripts/google
imageapi.py KeyWords Country Language Scroll_count Datelimit
⏳ 执行状态监控
由于此任务涉及自动化浏览器操作,可能需要较长时间(数分钟)。脚本在运行时会
持续输出带有时间戳的状态日志(例如 [14:30:05] Task Status: running)。
Agent 注意事项:
- - 在等待脚本返回结果期间,请密切关注终端输出。
- 只要终端持续输出新的状态日志,即表示任务正常运行,请勿误判为死锁或无响应。
- 如果状态长时间未变化,或脚本停止输出且未返回结果,则可考虑触发重试机制。
📊 数据输出
执行成功后,脚本将直接从 API 响应中解析并打印结果。结果包括:
- - isproduct:结果是否被检测为产品类列表
- link:结果关联的点击跳转 URL
- title:图片结果的标题或说明文字
- sourcelogo:来源网站 Logo URL
- source:结果中显示的来源网站名称
- relatedcontentid:Google 图片的相关内容标识符
- thumbnail:缩略图 URL
- index:结果在列表中的索引
⚠️ 错误处理与重试
在脚本执行过程中,如果发生错误(如网络波动或任务失败),Agent 应遵循以下逻辑:
- 1. 检查输出:
- 如果输出
包含 Invalid authorization,表示 API 密钥无效或已过期。此时
不要重试,引导用户检查并提供正确的 API 密钥。
- 如果输出
不包含 Invalid authorization 但任务执行失败(例如输出以 Error: 开头或结果为空),Agent 应
自动尝试重新执行脚本一次。
- 2. 重试限制:
- 自动重试限制为
一次。如果第二次尝试仍然失败,则停止重试并向用户报告具体的错误信息。
🌟 典型使用场景
- 1. 视觉内容素材获取:为创意研究和设计内容寻找特定图像。
- 竞品资产监控:扫描 Google 图片以获取竞争对手的产品风格和 Logo。
- 市场视觉研究:构建各国产品列表的数据集。
- 本地化图片趋势:追踪特定关键词在日本(jp)或法国(fr)出现的图片内容。
- 电商发现:提取点击跳转链接以追踪产品销售渠道。
- 数据丰富:获取与关键词相关的缩略图和高级标题。
- 品牌追踪:查找特定品牌作为图片结果出现的实例。
- SEO 关键词可视化:检查所选 SEO 关键词排名对应的视觉结果。
- 自动化内容聚合:为特定主题提供每日级别的视觉元数据列表。
- 全球图片搜索:以本地语言查找与全球事件或人物相关的图片。