Files
youtube-latest3/README.md

33 lines
958 B
Markdown

# youtube-latest3
Fetch the latest uploads from a YouTube channel URL (including dynamic `@handle` URLs like `https://www.youtube.com/@ludwig/videos`).
## Why this approach
This tool resolves the channel ID from the exact channel URL, then reads YouTube's official uploads feed:
- `https://www.youtube.com/feeds/videos.xml?channel_id=<CHANNEL_ID>`
That feed is ordered by newest uploads, so fetching the first 3 entries gives the latest 3 videos.
## Usage
```bash
python3 latest3.py "https://www.youtube.com/@ludwig/videos"
python3 latest3.py "@ludwig" --json
python3 latest3.py "https://www.youtube.com/@ludwig/videos" --limit 3 --json
```
## Output fields
- `id` - video ID
- `title` - video title
- `url` - watch URL
- `published` - ISO-8601 timestamp from the feed
## Notes
- Works with `@handle` URLs and plain `@handle` input.
- No API key required.
- If YouTube changes page markup for channel ID extraction, update `extract_channel_id()`.