Python script to scan YouTube channel playlists and detect unlisted videos
Project description
YouTube Channel Scanner
Python script to scan YouTube channel playlists and detect unlisted videos.
Description
This script analyzes a YouTube channel by:
- Retrieving all public videos from the channel
- Listing all public playlists
- Extracting videos from each playlist
- Comparing both lists to identify videos present in playlists but missing from public videos (= potentially unlisted)
Installation
Requirements
- Python 3.7+
- yt-dlp
Installing yt-dlp
pip install yt-dlp
Or with pipx:
pipx install yt-dlp
Usage
Basic command
python youtube_scanner.py "https://www.youtube.com/@ChannelName"
Available options
| Option | Description |
|---|---|
-o, --output |
Output JSON filename (default: youtube_scan_YYYY-MM-DD_HHMMSS.json) |
--playlists-only |
Scan playlists only (faster). Identifies unlisted videos by their availability status |
--detailed |
Re-fetch metadata for potentially unlisted videos to ensure accuracy |
Examples
Full scan:
python youtube_scanner.py "https://www.youtube.com/@IronKingLoL"
Quick scan (playlists only):
python youtube_scanner.py "https://www.youtube.com/@IronKingLoL" --playlists-only
With accurate dates (slower):
python youtube_scanner.py "@IronKingLoL" --detailed
With custom filename:
python youtube_scanner.py "https://www.youtube.com/@IronKingLoL" -o ironking_scan.json
Supported URL formats
https://www.youtube.com/@usernamehttps://www.youtube.com/c/ChannelNamehttps://www.youtube.com/channel/UCxxxxx
Output files
The script generates two files:
1. JSON file (youtube_scan_YYYY-MM-DD_HHMMSS.json)
Contains all structured data:
{
"channel_url": "https://www.youtube.com/@example",
"scan_date": "2025-11-29T14:30:52.123456",
"public_videos": [],
"playlist_videos": [],
"playlists": [],
"potentially_unlisted": [
{
"id": "dQw4w9WgXcQ",
"title": "Video title",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"availability": "unlisted",
"upload_date": "2024-03-15",
"found_in_playlist": "Playlist name"
}
]
}
2. Text file (youtube_scan_YYYY-MM-DD_HHMMSS_links.txt)
Simple list of links with dates:
# Potentially unlisted videos
[2025-03-16] https://www.youtube.com/watch?v=xxxxx - Video title
[2025-02-11] https://www.youtube.com/watch?v=yyyyy - Another video
# All playlist videos
[2025-03-16] https://www.youtube.com/watch?v=xxxxx - Video title
...
How it works
Unlisted videos on YouTube:
- Are not visible on the channel page
- Are not indexed by YouTube search
- But can be added to public playlists
The script uses two detection methods:
-
Full scan mode (default): Compares videos in playlists with public channel videos. If a video is in a playlist but not in public videos, it's likely unlisted.
-
Playlists-only mode (
--playlists-only): Identifies videos directly by their availability status (unlisted/private) reported by yt-dlp.
Limitations
- Private videos: Cannot be played without permission, but can be detected in playlists if their status is visible
- Private playlists: Not scanned
- Possible false positives: A video can be in a playlist without belonging to the channel
- Deleted videos: Sometimes appear in playlists but are no longer accessible
- Rate limiting: YouTube may throttle requests if too frequent
- Performance: The script fetches full video metadata to provide accurate dates and availability. For very large channels with many playlists, this may take some time
Troubleshooting
"yt-dlp is not installed"
pip install yt-dlp
Timeout on large channels
The script has a 5-minute timeout per command. For very large channels, use --playlists-only to reduce scan time.
No unlisted videos found
This is normal if:
- The channel has no unlisted videos in its playlists
- All playlists are private
- The channel has no playlists
Author
Thomas Lamarche - Initial work - OloZ17
License
MIT License - Free to use and modify.
Contributing
Contributions are welcome! Feel free to open an issue or pull request.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yt_scanner-0.1.3.tar.gz.
File metadata
- Download URL: yt_scanner-0.1.3.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e57b3484ec4d2f0055a3fe4a66cbc1870e8f36a5f6bc42af2545d0a1ef6263
|
|
| MD5 |
fa54a84584151b22da2aed4cbe0e0f13
|
|
| BLAKE2b-256 |
7f707c8596534d06bb6bd36fd34f6fe217e11106f4f845a99214374f91827f01
|
File details
Details for the file yt_scanner-0.1.3-py3-none-any.whl.
File metadata
- Download URL: yt_scanner-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c01615b7e18e0e9e0e592f6261ada596c631014500727c829612aeab158760d3
|
|
| MD5 |
43eec6c5ac2d07b7d98203ee6f5581c0
|
|
| BLAKE2b-256 |
0dd3c3fd15488e7630e7143be57dd72599aa4600dc2ebfce51afd803bfbc0fd5
|