
Youtube Search
- 46 installs
- 6 repo stars
- Updated July 22, 2026
- julianobarbosa/claude-code-skills
Search YouTube and return structured video results with metadata and engagement metrics using yt-dlp. Use for YouTube search, video research, content analysis.
About
Search YouTube and return structured video results with metadata and engagement metrics.. Use for YouTube search, video research, content discovery.
- beginner skill
- core: ai & agent building
Youtube Search by the numbers
- 46 all-time installs (skills.sh)
- +1 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #7,629 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/julianobarbosa/claude-code-skills --skill youtube-searchAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 46 |
|---|---|
| repo stars | ★ 6 |
| Last updated | July 22, 2026 |
| Repository | julianobarbosa/claude-code-skills ↗ |
What it does
Search YouTube and return structured video results with metadata and engagement metrics using yt-dlp. Use for YouTube search, video research, content analysis.
Files
YouTubeSearch
Search YouTube by query and return structured, human-readable results with metadata and engagement metrics.
What It Does
Runs a yt-dlp search against YouTube, returning the top N results (default 20) filtered to a recent time window (default 6 months). Each result includes:
- Title and URL
- Channel name and subscriber count
- View count and duration
- Upload date
- Engagement ratio (views / subscribers) — a quick signal for whether a video over- or under-performed relative to the channel's audience
Numbers are human-readable (e.g., 1.2M, 45.3K). Results are separated by dividers for easy scanning.
Requirements
yt-dlpinstalled and in PATHjqinstalled and in PATHbcinstalled (standard on macOS/Linux)
Usage
Run the bundled script:
bash ~/.claude/skills/YouTubeSearch/scripts/yt-search.sh "<search query>" [--count N] [--months N]Parameters
| Flag | Default | Description |
|---|---|---|
| (positional) | — | Search query (required) |
--count | 20 | Number of results to return |
--months | 6 | Only include videos from the last N months |
Examples
# Basic search — top 20 results from last 6 months
bash ~/.claude/skills/YouTubeSearch/scripts/yt-search.sh "kubernetes security best practices"
# Narrow to 5 results from the last month
bash ~/.claude/skills/YouTubeSearch/scripts/yt-search.sh "rust async tutorial" --count 5 --months 1
# Broader window — last 2 years
bash ~/.claude/skills/YouTubeSearch/scripts/yt-search.sh "home lab setup" --months 24Interpreting the Engagement Ratio
The views-to-subscribers ratio helps identify standout content:
- > 1.0x — The video got more views than the channel has subscribers. Strong signal that the topic resonated or the algorithm boosted it.
- 0.3x - 1.0x — Typical range for established channels.
- < 0.3x — Below average reach. Could mean the topic is niche, the thumbnail/title underperformed, or the channel's audience has moved on.
This metric is most useful for comparing videos on the same topic — a 5.0x ratio on a small channel often means the content hit a nerve.
How Claude Should Use This
When the user asks to search YouTube or find videos:
1. Run the script with the user's query and any specified flags 2. Present the results — the script output is already formatted for terminal reading 3. If the user wants analysis (e.g., "which of these are worth watching?"), use the engagement ratio and view counts to highlight standouts 4. If subscriber count shows "N/A" for many results, that's normal — yt-dlp can't always fetch channel metadata from search results
Troubleshooting
- No results: Try broadening the query or increasing
--months - Slow: Each result requires a metadata fetch. Reduce
--countfor faster results. - "N/A" for subscribers: yt-dlp sometimes can't resolve channel follower counts from search. The other fields will still populate.
---
Gotchas
- API `order=date` still applies relevance ranking — recent uploads can be deprioritized. Two-query merge (date + relevance) is the workaround.
- Quota is per-project per-day — search is expensive (100 units/query); bursting locks the project out for the day.
- `regionCode` parameter changes results — same query from different regions returns different videos; default is viewer's IP geo.
- Transcript API is separate from search API — transcript availability is per-video; some videos have none and the API returns no error.
- Channel ID vs Channel username: handles (
@name) vs legacy usernames vs IDs are three different identifiers; resolution requires explicit channel-list call. - Embedded videos blocked by uploader: search may return them, but a downstream tool that embeds will fail without warning — check
status.embeddable.
#!/usr/bin/env bash
# YouTubeSearch — search YouTube via yt-dlp and output structured results
set -euo pipefail
# Defaults
QUERY=""
COUNT=20
MONTHS=6
usage() {
echo "Usage: yt-search.sh <query> [--count N] [--months N]"
echo " query Search terms (required)"
echo " --count Number of results (default: 20)"
echo " --months Filter to last N months (default: 6)"
exit 1
}
# Parse args
while [[ $# -gt 0 ]]; do
case "$1" in
--count) COUNT="$2"; shift 2 ;;
--months) MONTHS="$2"; shift 2 ;;
--help|-h) usage ;;
*)
if [[ -z "$QUERY" ]]; then
QUERY="$1"
else
QUERY="$QUERY $1"
fi
shift
;;
esac
done
[[ -z "$QUERY" ]] && usage
# Calculate date cutoff (YYYYMMDD) for post-filtering
if [[ "$(uname)" == "Darwin" ]]; then
DATE_CUTOFF=$(date -v-"${MONTHS}m" +%Y%m%d)
else
DATE_CUTOFF=$(date -d "-${MONTHS} months" +%Y%m%d)
fi
# Human-readable number formatting
format_number() {
local n="$1"
if [[ -z "$n" || "$n" == "null" || "$n" == "None" ]]; then
echo "N/A"
return
fi
if (( n >= 1000000000 )); then
printf "%.1fB" "$(echo "scale=1; $n / 1000000000" | bc)"
elif (( n >= 1000000 )); then
printf "%.1fM" "$(echo "scale=1; $n / 1000000" | bc)"
elif (( n >= 1000 )); then
printf "%.1fK" "$(echo "scale=1; $n / 1000" | bc)"
else
echo "$n"
fi
}
# Format duration from seconds
format_duration() {
local secs="$1"
if [[ -z "$secs" || "$secs" == "null" || "$secs" == "None" ]]; then
echo "N/A"
return
fi
local h=$(( secs / 3600 ))
local m=$(( (secs % 3600) / 60 ))
local s=$(( secs % 60 ))
if (( h > 0 )); then
printf "%d:%02d:%02d" "$h" "$m" "$s"
else
printf "%d:%02d" "$m" "$s"
fi
}
# Format upload date YYYYMMDD -> YYYY-MM-DD
format_date() {
local d="$1"
if [[ -z "$d" || "$d" == "null" || ${#d} -lt 8 ]]; then
echo "N/A"
return
fi
echo "${d:0:4}-${d:4:2}-${d:6:2}"
}
echo ""
echo "============================================================"
echo " YouTube Search: \"$QUERY\""
echo " Results: up to $COUNT | Period: last $MONTHS months"
echo "============================================================"
echo ""
# Fetch more results than needed to allow for date filtering
# yt-dlp's --dateafter doesn't work with search, so we filter manually
FETCH_COUNT=$(( COUNT * 2 ))
if (( FETCH_COUNT < 30 )); then
FETCH_COUNT=30
fi
# yt-dlp outputs multi-line JSON; compact to one JSON object per line
RESULTS=$(yt-dlp \
"ytsearch${FETCH_COUNT}:${QUERY}" \
--dump-json \
--no-download \
--no-warnings \
2>/dev/null | jq -c '.' || true)
if [[ -z "$RESULTS" ]]; then
echo "No results found."
exit 0
fi
INDEX=0
while IFS= read -r line; do
# Date filter: skip videos older than cutoff
UPLOAD_DATE=$(echo "$line" | jq -r '.upload_date // empty')
if [[ -n "$UPLOAD_DATE" && "$UPLOAD_DATE" < "$DATE_CUTOFF" ]]; then
continue
fi
INDEX=$((INDEX + 1))
if (( INDEX > COUNT )); then
break
fi
TITLE=$(echo "$line" | jq -r '.title // "N/A"')
CHANNEL=$(echo "$line" | jq -r '.channel // .uploader // "N/A"')
SUBS=$(echo "$line" | jq -r '.channel_follower_count // empty')
VIEWS=$(echo "$line" | jq -r '.view_count // empty')
DURATION=$(echo "$line" | jq -r '.duration // empty')
URL=$(echo "$line" | jq -r '.webpage_url // .url // "N/A"')
SUBS_FMT=$(format_number "${SUBS:-}")
VIEWS_FMT=$(format_number "${VIEWS:-}")
DURATION_FMT=$(format_duration "${DURATION:-}")
DATE_FMT=$(format_date "${UPLOAD_DATE:-}")
# Engagement ratio
if [[ -n "$SUBS" && "$SUBS" != "null" && "$SUBS" != "0" && -n "$VIEWS" && "$VIEWS" != "null" ]]; then
RATIO=$(printf "%.2f" "$(echo "scale=4; $VIEWS / $SUBS" | bc)")
RATIO_FMT="${RATIO}x"
else
RATIO_FMT="N/A"
fi
echo " #${INDEX}"
echo " Title: $TITLE"
echo " Channel: $CHANNEL"
echo " Subscribers: $SUBS_FMT"
echo " Views: $VIEWS_FMT"
echo " Duration: $DURATION_FMT"
echo " Uploaded: $DATE_FMT"
echo " Engagement: $RATIO_FMT (views/subs)"
echo " URL: $URL"
echo ""
echo "------------------------------------------------------------"
echo ""
done <<< "$RESULTS"
echo " Search complete."