- Joined
- May 2, 2024
- Messages
- 79
- Reaction score
- 101
- Points
- 18
- vip
- 49 credits
Offline
Processor M3U Script with TMDB Metadata
M3U Processor Script with TMDB MetadataFeatures:
- Auto-classifies content as Movies or TV Series
- Enriches with:
- Official genres (primary category)
- High-quality posters (via TMDB API)
- Handles 40,000+ entries efficiently
- Smart caching system to avoid duplicate API calls
- Supports titles with release years (e.g., "Movie (2023)")
Requirements:
- Python 3.x
- Free TMDB API key (www.themoviedb.org)
Sample Output:
#EXTINF:-1 tvg-id="" tvg-name="" tvg-logo="image.tmdb.org" group-title="Movie | Drama",The Shawshank Redemption (1994)
```
Pro Tip:
For large lists (>20k entries), the script automatically:
- Throttles API requests to comply with TMDB limits
- Resumes interrupted processes
- Logs all processed items
Example Input → Output
Input (Original M3U)
#EXTINF:-1,The Shawshank Redemption (1994)
Output (Enhanced M3U)
#EXTINF:-1 tvg-id="" tvg-name="" tvg-logo="image.tmdb.org" group-title="Movie | Drama",The Shawshank Redemption (1994)
4. Performance Optimizations
- Rate Limiting: Delays requests (0.34s) to respect TMDB API limits.
- Exponential Backoff: Retries failed requests with increasing delays.
- Bulk Processing: Efficiently handles large files (40k+ entries).
5. How to Run
bashCopy
python processador_m3u.py input.m3u output.m3u
First Run: May take hours (due to API rate limits).
Subsequent Runs: Faster (uses cached data).
6. Key Dependencies
- requests (for TMDB API calls).
- No external databases needed (uses local JSON cache).
Attachments





