domains / media / youtube-data-access / youtube-api

youtube-api

Skill card

combined

The three copies are not reproductions of one procedure; they are three different YouTube data access backends with different authentication, endpoints, and capabilities. ZeroPointRepo uses TranscriptAPI for transcripts and metadata without Google OAuth. browser-act uses a BrowserAct API key and a Python script to scrape structured metrics. LeoYeAI uses the Maton gateway to proxy the official YouTube Data API v3 with managed OAuth. Choosing one as authentic would hide the other two real alternatives.

Repositories

RepositoryPath
ZeroPointRepo/youtube-skillsclawhub/youtube-api/SKILL.md
browser-act/skillssolutions/video-platforms/youtube-api-skill/SKILL.md
LeoYeAI/openclaw-master-skillsskills/youtube-api-skill/SKILL.md

Other copies

RoleRepositoryPath
peerZeroPointRepo/youtube-skillsclawhub/youtube-api/SKILL.md
peerbrowser-act/skillssolutions/video-platforms/youtube-api-skill/SKILL.md
peerLeoYeAI/openclaw-master-skillsskills/youtube-api-skill/SKILL.md
adapterZeroPointRepo/youtube-skillsskills/youtube-api/SKILL.md

Combined skill

# YouTube Data Access

This skill provides three alternative backends for accessing YouTube data. Choose the backend that matches the user's needs and available credentials.

## Backend Selection

1. **TranscriptAPI (ZeroPointRepo)**: Use when you need transcripts, video metadata, channel info, search, or playlists without Google API quotas or OAuth. Requires `TRANSCRIPT_API_KEY`.
2. **BrowserAct (browser-act)**: Use when you need automated extraction of detailed video metrics (views, likes, comments, duration) via keyword search and upload date filters. Requires `BROWSERACT_API_KEY` and Python.
3. **Maton Gateway (LeoYeAI)**: Use when you need the official YouTube Data API v3 with managed OAuth, including playlist management, comments, and subscriptions. Requires `MATON_API_KEY`.

## Backend 1: TranscriptAPI

### Setup
If `TRANSCRIPT_API_KEY` is not set, guide the user to get a free key at https://transcriptapi.com.

### Required Headers
Every request needs:
- `Authorization: Bearer $TRANSCRIPT_API_KEY`
- `User-Agent: <AgentName>/<version>` (do not omit; Cloudflare blocks bare defaults)

### Endpoints
Base URL: `https://transcriptapi.com/api/v2/youtube/`

| Endpoint | Method | Cost |
| --- | --- | --- |
| `/info?video_url=ID` | GET | free |
| `/video/metadata?video_url=ID` | GET | 1 |
| `/transcript?video_url=ID` | GET | 1 |
| `/search?q=QUERY&type=video` | GET | 1 |
| `/channel/resolve?input=@handle` | GET | free |
| `/channel/info?channel=@handle` | GET | 1 |
| `/channel/latest?channel=@handle` | GET | free |
| `/channel/videos?channel=@handle` | GET | 1/page |
| `/channel/search?channel=@handle&q=Q` | GET | 1 |
| `/channel/playlists?channel=@handle` | GET | 1/page |
| `/channel/posts?channel=@handle` | GET | 1/page |
| `/channel/sections?channel=@handle` | GET | 1 |
| `/playlist/videos?playlist=PL_ID` | GET | 1/page |

### Examples

Search videos:
```bash
curl -s "https://transcriptapi.com/api/v2/youtube/search?q=python+tutorial&type=video&limit=10" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY" \
  -H "User-Agent: YourAgent/1.0"
```

Get transcript:
```bash
curl -s "https://transcriptapi.com/api/v2/youtube/transcript?video_url=dQw4w9WgXcQ&format=text&include_timestamp=true&send_metadata=true" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY" \
  -H "User-Agent: YourAgent/1.0"
```

Check video info (free):
```bash
curl -s "https://transcriptapi.com/api/v2/youtube/info?video_url=dQw4w9WgXcQ" \
  -H "Authorization: Bearer $TRANSCRIPT_API_KEY" \
  -H "User-Agent: YourAgent/1.0"
```

## Backend 2: BrowserAct

### Setup
If `BROWSERACT_API_KEY` is not set, ask the user to get a key at https://www.browseract.com/reception/integrations.

### Invocation
```bash
python -u ./scripts/youtube_api.py "keywords" "upload_date"
```

Parameters:
- `keywords`: Search keywords (string)
- `upload_date`: `Today`, `This week`, `This month`, `This year` (default: `This week`)

### Monitoring
The script outputs timestamped status logs. Do not misinterpret ongoing logs as a deadlock. If output stops and no result is returned, retry once.

### Error Handling
- If output contains `"Invalid authorization"`, do not retry; ask the user to recheck the API key.
- If the task fails for other reasons, retry once. If the second attempt fails, report the error.

### Output Fields
`channel_title`, `channel_url`, `subscribers`, `video_title`, `video_url`, `publish_date`, `view_count`, `video_duration`, `comment_count`, `like_count`

## Backend 3: Maton Gateway

### Setup
If `MATON_API_KEY` is not set, guide the user to get a key at https://maton.ai/settings.

### Base URL
`https://gateway.maton.ai/youtube/{native-api-path}`

The gateway proxies to `www.googleapis.com` and injects the OAuth token.

### Authentication
`Authorization: Bearer $MATON_API_KEY`

### Connection Management
Manage OAuth connections at `https://ctrl.maton.ai`.

List connections:
```bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=youtube&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

Create connection:
```bash
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'youtube'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
```

Open the returned `url` in a browser to complete OAuth.

If multiple connections exist, specify one with the `Maton-Connection` header.

### API Reference

Search:
```bash
curl -s -X GET "https://gateway.maton.ai/youtube/youtube/v3/search?part=snippet&q=machine+learning&type=video&maxResults=10&order=viewCount" -H "Authorization: Bearer $MATON_API_KEY"
```

Get video details:
```bash
curl -s -X GET "https://gateway.maton.ai/youtube/youtube/v3/videos?part=snippet,statistics,contentDetails&id={videoId}" -H "Authorization: Bearer $MATON_API_KEY"
```

## Conflicts

- **ZeroPointRepo/youtube-skills** uses `TRANSCRIPT_API_KEY` and `transcriptapi.com` endpoints; **browser-act/skills** uses `BROWSERACT_API_KEY` and a local Python script; **LeoYeAI/openclaw-master-skills** uses `MATON_API_KEY` and `gateway.maton.ai` proxying the YouTube Data API v3.
- **ZeroPointRepo** and **browser-act** are read-only data extraction; **LeoYeAI** supports OAuth connection management and official API operations like playlist management and comments.
- **browser-act** requires a Python runtime; **ZeroPointRepo** and **LeoYeAI** examples use curl or urllib without a separate Python script dependency.