tikhub-youtube-search
This Claude Code skill provides lightweight TikHub YouTube search and video detail requests, optimized for single API calls via curl or minimal Python. It saves raw JSON responses by default and includes an optional post-processor that converts raw files into CSV and simplified JSON formats, making it ideal when users need YouTube search results, pagination via continuation tokens, or structured video metadata without heavy wrapper dependencies.
git clone --depth 1 https://github.com/inclusionAI/AWorld /tmp/tikhub-youtube-search && cp -r /tmp/tikhub-youtube-search/aworld-skills/youtube_search ~/.claude/skills/tikhub-youtube-searchSKILL.md
# TikHub YouTube Search
## What this skill gives you
This skill is optimized for the **common case: one search or one video detail request**.
It provides:
1. **Minimal request patterns**
- `curl` for quickest validation
- tiny `httpx` example for people who prefer Python
2. **Raw JSON saving**
- save the full TikHub response after each request
- useful for audit, replay, and later post-processing
3. **One optional post-processor**
- `postprocess_youtube_raw.py`
- reads one raw file or a directory of raw files
- writes `youtube_search_summary.csv` and `youtube_search_summary.json`
4. **Optional batch guidance**
- enough information for concurrent use later
- intentionally brief, not the main path
Does **not** import `TikHub-Multi-Functional-Downloader` or any other project package.
## API key requirement
This skill intentionally does **not** contain any API key.
Use one of these:
- environment variable: `TIKHUB_API_KEY`
- ask the user to provide an API key explicitly
If the key is missing, stop and ask for it instead of hardcoding one into scripts.
## Install
```bash
pip install httpx
```
Post-processor: **no extra packages**.
## API (for reference)
- Search:
`GET https://api.tikhub.io/api/v1/youtube/web_v2/get_general_search_v2?keyword=...`
- Video details:
`GET https://api.tikhub.io/api/v1/youtube/web_v2/get_video_info?video_id=...&language_code=zh-CN&need_format=true`
- Header:
`Authorization: Bearer <API_KEY>`
## Notes from real requests
- `keyword` should be passed through request params or URL-encoded.
- `need_format` should be sent as `true` or `false`; a blank parameter may fail boolean parsing.
- Search responses usually contain `data.videos`, `data.shorts`, `data.channels`, `data.playlists`, and sometimes `continuation_token`.
- Detail responses may have empty structured fields while display fields are populated; `view_count_text`, `like_count_text`, and `date_text` are often more reliable than `view_count`, `like_count`, and `upload_date`.
---
## Preferred path: single request
### 1. Quickest: `curl`
Search:
```bash
curl --location --request GET "https://api.tikhub.io/api/v1/youtube/web_v2/get_general_search_v2?keyword=Python%20tutorial" \
--header "Authorization: Bearer $TIKHUB_API_KEY"
```
Video detail:
```bash
curl --location --request GET "https://api.tikhub.io/api/v1/youtube/web_v2/get_video_info?video_id=_uQrJ0TkZlc&language_code=zh-CN&need_format=true" \
--header "Authorization: Bearer $TIKHUB_API_KEY"
```
With optional search filters:
```bash
curl --location --request GET "https://api.tikhub.io/api/v1/youtube/web_v2/get_general_search_v2?keyword=cute%20cats&type=video&sort_by=relevance" \
--header "Authorization: Bearer $TIKHUB_API_KEY"
```
### 2. Preferred Python pattern: tiny `httpx`
If the user wants Python, prefer a **small request snippet**, not a framework.
Search and save raw JSON:
```python
import json
import os
import httpx
api_key = os.getenv("TIKHUB_API_KEY", "").strip()
if not api_key:
raise SystemExit("Missing TIKHUB_API_KEY")
url = "https://api.tikhub.io/api/v1/youtube/web_v2/get_general_search_v2"
params = {"keyword": "Python tutorial"}
headers = {"Authorization": f"Bearer {api_key}", "Accept": "*/*"}
with httpx.Client(timeout=30.0, follow_redirects=True) as client:
raw = client.get(url, params=params, headers=headers).json()
with open("youtube_search_raw.json", "w", encoding="utf-8") as f:
json.dump(raw, f, ensure_ascii=False, indent=2)
for item in raw.get("data", {}).get("videos", [])[:5]:
print(item.get("title", ""))
print(item.get("url", ""))
```
Detail and save raw JSON:
```python
import json
import os
import httpx
api_key = os.getenv("TIKHUB_API_KEY", "").strip()
if not api_key:
raise SystemExit("Missing TIKHUB_API_KEY")
url = "https://api.tikhub.io/api/v1/youtube/web_v2/get_video_info"
params = {
"video_id": "_uQrJ0TkZlc",
"language_code": "zh-CN",
"need_format": "true",
}
headers = {"Authorization": f"Bearer {api_key}", "Accept": "*/*"}
with httpx.Client(timeout=30.0, follow_redirects=True) as client:
raw = client.get(url, params=params, headers=headers).json()
with open("youtube_detail_raw.json", "w", encoding="utf-8") as f:
json.dump(raw, f, ensure_ascii=False, indent=2)
data = raw.get("data", {})
print("title:", data.get("title", ""))
print("author:", data.get("author", ""))
print("views:", data.get("view_count_text", "") or data.get("view_count", ""))
print("video_url:", data.get("video_url", ""))
```
---
## Save raw JSON by default
For this workflow, the recommended default is:
1. request the API
2. save the **full** raw JSON immediately
3. print only a few useful fields for quick inspection
4. optionally run the post-processor later
Suggested file naming:
- search raw: `search_<keyword>_<request_id>.json`
- detail raw: `detail_<video_id>_<request_id>.json`
If `request_id` is unavailable, hash the keyword or video ID.
---
## Post-process raw JSON
Save as `postprocess_youtube_raw.py` (**stdlib only**).
Input:
- one raw search/detail JSON file
- or a directory containing multiple raw JSON files
Output:
- `youtube_search_summary.csv`
- `youtube_search_summary.json`
```python
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import csv
import json
import os
import sys
from glob import glob
from typing import Any, Dict, List
def collect_inputs(path: str) -> List[str]:
if os.path.isfile(path):
return [path]
if os.path.isdir(path):
return sorted(glob(os.path.join(path, "*.json")))
raise FileNotFoundError(path)
def as_list(value: Any) -> List[dict]:
return value if isinstance(value, list) else []
def flatten_for_csv(row: Dict[str, Any]) -> Dict[str, Any]:
out: Dict[str, Any] = {}
for k, v in row.items():
if v is None:
out[k] = ""
elif isinstance(v, (dict, list)):
out[k] = json.dumps(v, ensure_ascii=False)Create ad-ready product images (single or collage) by back-solving sub-image sizes from target output ratio, grounding scene design with media_comprehension, generating images via image_generator with strict request params and actor-count control, and pairing each deliverable with a short social tagline for 小红书/抖音.
Create ad-ready product video from product images, with or without character/subject images. The workflow leverages AI-powered image composition, scene understanding, and video generation. Video prompts should follow commercial shot language—visual hooks, product presence, hero shots, detail showcase, function expression, and dynamic visuals.
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
A professional skill for App Evaluation (evaluating app's performance with score) and App Improvement (giving professional suggestions for improving the app's performance).
>-
Search and summarize the latest 7 days of AI news and X discussions using public sources plus browser-based X collection. Use for recent AI news, trends, X discussions, industry briefs, and summaries organized into hot topics, viewpoints, and opportunity areas.
An intelligent assistant specialized in handling media files (images/audio/video). **Only for media file analysis**, does not handle document types.\n\n✅ Media files that can be processed:\n- Images: .jpg, .jpeg, .png, .gif, .bmp, .webp, .svg\n- Audio: .mp3, .wav, .m4a, .flac, .aac, .ogg\n- Video: .mp4, .avi, .mov, .mkv, .webm, .flv\n\n❌ Files that cannot be processed (please do not trigger this skill):\n- Documents: .pdf, .doc, .docx, .txt, .md, .rtf\n- Spreadsheets: .xlsx, .xls, .csv, .tsv\n- Presentations: .pptx, .ppt, .key\n- Code: .py, .js, .ts, .java, .cpp, .go, .rs\n- Archives: .zip, .tar, .gz, .rar, .7z\n- Executables: .exe, .bin, .app, .dmg\n- Databases: .db, .sqlite, .sql\n- Configuration files: .json, .xml, .yaml, .yml, .toml, .ini\n- Web pages: .html, .htm, .css\n\n**Trigger conditions**: When the user explicitly requests to analyze image/audio/video content, or when the file extension belongs to the aforementioned media types.".
Analyzes and automatically optimizes existing agents by improving system prompts and tool configuration.