Communitygithub.com

V4TIME/V4SKILL

透過 curl + jq 從 Tenor 搜尋及下載 GIF。

V4SKILL 是什麼?

這項技能讓 AI 代理或開發者可以直接使用 curl 和 jq 從 Tenor API 搜尋與下載 GIF,無需額外工具或複雜的 SDK。它支援 macOS 和 Linux 常見的 curl/jq 環境,只需設定一個免費的 Tenor API 金鑰(從 Google Cloud Console 取得)即可使用。技能涵蓋搜尋 GIF(支援全尺寸與預覽格式)、下載最熱門結果、取得完整中繼資料(包括標題、網址、尺寸),並可調整 API 參數如查詢字詞、數量限制、內容安全篩選及語言區域。可用於聊天機器人、視覺內容產生或反應 GIF 的擷取,輸出格式可直接用於 Markdown 或檔案儲存。

相容平台~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 網址
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搜尋查詢(空格用 + 編碼)
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 網址較為輕量
  • GIF 網址可直接用於 Markdown:![alt](url)

Individual skills in this repo

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

相關技能