Communitygithub.com

V4TIME/V4SKILL

通过curl和jq从Tenor搜索/下载GIF。

V4SKILL 是什么?

这个技能通过curl和jq直接调用Tenor API来搜索和下载GIF,无需额外工具。它使用环境变量`TENOR_API_KEY`进行身份验证,支持搜索、下载、获取元数据等操作。适用于寻找反应GIF、创建视觉内容或聊天中发送GIF的场景。需要预先在环境变量中设置API密钥,curl和jq为系统标准工具。支持macOS/Linux平台。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/V4TIME/V4SKILL/tree/HEAD/media/gif-search

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

预览

来自技能 README

alt

文档

GIF 搜索 (Tenor API)

使用 curl 直接通过 Tenor API 搜索和下载 GIF。无需额外工具。

何时使用

用于查找反应 GIF、创建视觉内容以及在聊天中发送 GIF。

设置

在环境变量中设置您的 Tenor API 密钥(添加到 ${HERMES_HOME:-~/.hermes}/.env):

TENOR_API_KEY=your_key_here

在 https://developers.google.com/tenor/guides/quickstart 获取免费的 API 密钥——Google Cloud Console 的 Tenor API 密钥免费且具有慷慨的速率限制。

前提条件

  • curl 和 jq(macOS/Linux 上的标准工具)
  • TENOR_API_KEY 环境变量

搜索 GIF

# 搜索并获取 GIF URL
curl -s "https://tenor.googleapis.com/v2/search?q=thumbs+up&limit=5&key=${TENOR_API_KEY}" | jq -r '.results[].media_formats.gif.url'

# 获取更小/预览版本
curl -s "https://tenor.googleapis.com/v2/search?q=nice+work&limit=3&key=${TENOR_API_KEY}" | jq -r '.results[].media_formats.tinygif.url'

下载 GIF

# 搜索并下载第一个结果
URL=$(curl -s "https://tenor.googleapis.com/v2/search?q=celebration&limit=1&key=${TENOR_API_KEY}" | jq -r '.results[0].media_formats.gif.url')
curl -sL "$URL" -o celebration.gif

获取完整元数据

curl -s "https://tenor.googleapis.com/v2/search?q=cat&limit=3&key=${TENOR_API_KEY}" | jq '.results[] | {title: .title, url: .media_formats.gif.url, preview: .media_formats.tinygif.url, dimensions: .media_formats.gif.dims}'

API 参数

参数描述
q搜索查询(空格使用 + 进行 URL 编码)
limit最大结果数(1-50,默认 20)
keyAPI 密钥(来自 $TENOR_API_KEY 环境变量)
media_filter格式过滤:gif, tinygif, mp4, tinymp4, webm
contentfilter安全级别:off, low, medium, high
locale语言:en_US, es, fr 等

可用媒体格式

每个结果在 .media_formats 下包含多种格式:

格式用途
gif全质量 GIF
tinygif小预览 GIF
mp4视频版本(文件体积更小)
tinymp4小预览视频
webmWebM 视频
nanogif微缩缩略图

备注

  • 对查询进行 URL 编码:空格使用 +,特殊字符使用 %XX
  • 在聊天中发送时,tinygif URL 更轻量
  • GIF URL 可直接在 Markdown 中使用:![alt](url)

Individual skills in this repo

This repo contains 12 individual skills — each has its own dedicated page.

相关技能