AgentSkillsCN

youtube

通过Invidious搜索YouTube视频。当用户要求查找、搜索或查看视频时自动触发。

SKILL.md
--- frontmatter
name: youtube
description: Search YouTube videos via Invidious. Auto-triggers when user asks to find, search for, or look up videos.

YouTube Video Search

Search YouTube videos using the Invidious API at https://yt.tarka.dev.

When to Use

Auto-trigger this skill when the user:

  • Asks to "find a video about..."
  • Asks to "search YouTube for..."
  • Asks to "look up videos on..."
  • Wants video recommendations on a topic
  • Asks "are there any videos about..."

How to Search

Use WebFetch to query the Invidious API:

code
https://yt.tarka.dev/api/v1/search?q=<query>&type=video

Formatting Results

Format each video as a lazy-loaded embed. Only the thumbnail loads initially; clicking plays the video via iframe.

html
<div class="video-embed">
  <div
    class="video-embed__player"
    onclick="this.innerHTML='<iframe src=\'https://yt.tarka.dev/embed/{videoId}?autoplay=1\' allowfullscreen></iframe>'"
  >
    <img src="{thumbnail_url}" alt="{title}" />
    <div class="video-embed__play"></div>
    <span class="video-embed__duration">{duration}</span>
  </div>
  <div class="video-embed__info">
    <a
      href="https://yt.tarka.dev/watch?v={videoId}"
      target="_blank"
      class="video-embed__title"
      >{title}</a
    >
    <div class="video-embed__meta">
      <span class="video-embed__channel">{author}</span>
      <span class="video-embed__stats">{viewCountText} · {publishedText}</span>
    </div>
  </div>
</div>

Duration Formatting

Convert lengthSeconds to human-readable format:

  • Under 1 hour: MM:SS (e.g., 12:34)
  • 1 hour or more: H:MM:SS (e.g., 1:23:45)

Thumbnail Selection

Use the medium quality thumbnail: https://yt.tarka.dev/vi/{videoId}/mqdefault.jpg

Example

When user asks "find me a video about Clojure macros":

<div class="video-embed"> <div class="video-embed__player" onclick="this.innerHTML='<iframe src=\'https://yt.tarka.dev/embed/ciGyHkDuPAE?autoplay=1\' allowfullscreen></iframe>'"> <img src="https://yt.tarka.dev/vi/ciGyHkDuPAE/mqdefault.jpg" alt="Clojure Tutorial"> <div class="video-embed__play"></div> <span class="video-embed__duration">1:11:23</span> </div> <div class="video-embed__info"> <a href="https://yt.tarka.dev/watch?v=ciGyHkDuPAE" target="_blank" class="video-embed__title">Clojure Tutorial</a> <div class="video-embed__meta"> <span class="video-embed__channel">Derek Banas</span> <span class="video-embed__stats">175K views · 8 years ago</span> </div> </div> </div>

Show 3-5 results by default. Click thumbnail to play inline, click title to open in new tab.

Notes

  • Always use https://yt.tarka.dev (user's Invidious instance)
  • Thumbnails load instantly; iframe only loads on click
  • If no results, suggest alternative search terms