A powerful Telegram bot that monitors Spotify playlists and automatically downloads and shares new tracks to your Telegram channel.
- 🎼 Multiple Playlist Support: Monitor multiple Spotify playlists simultaneously
- 🤖 Bot Management: Add/remove playlists directly through Telegram commands
- ⏰ Automatic Monitoring: Checks for new tracks every 6 hours
- 📤 Auto-Upload: Automatically downloads and sends new tracks to your channel
- 🔐 Admin Control: Secure admin-only access to bot commands
- 🐳 Fully Dockerized: Easy deployment with Docker Compose
- 📊 Statistics: Track playlist stats and bot performance
- 💾 Persistent Storage: All data saved and maintained across restarts
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ Spotify │─────▶│ Docker Bot │─────▶│ Telegram │
│ Playlists │ │ + Deemix │ │ Channel │
└─────────────┘ └──────────────┘ └─────────────┘
- Docker and Docker Compose installed
- Telegram Bot Token (from @BotFather)
- Telegram Channel (make bot admin)
- Spotify API credentials (from Spotify Developer Dashboard)
- Deezer account (free account works, but limited to 128kbps)
git clone <your-repo-url>
cd spotify-telegram-botcp .env.example .env
nano .env # Edit with your credentialsRequired environment variables:
# Get from @BotFather
TELEGRAM_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
# Your channel ID (use @userinfobot, forward a message from channel)
CHANNEL_ID=-1001234567890
# Get from https://developer.spotify.com/dashboard
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
# Your Telegram user ID (from @userinfobot)
ADMIN_IDS=123456789,987654321
# Optional: Deezer ARL (can configure later via bot)
DEEZER_ARL=The bot needs a Deezer ARL token to download music. You can:
Option A: Add to .env before starting
- Go to https://www.deezer.com and login
- Press F12 → Application/Storage → Cookies → deezer.com
- Find
arlcookie and copy its value - Add to
.env:DEEZER_ARL=your_arl_token_here
Option B: Configure after starting (easier)
- Start the bot without ARL
- Message the bot and follow setup instructions
# Build and start the bot
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the bot
docker-compose downIf you didn't add ARL to .env:
- The bot will detect missing ARL on first download attempt
- Follow the instructions in bot logs
- Or manually create
/root/.config/deemix/.arlfile in container
/start- Welcome message and bot info/help- Display help and usage instructions/listplaylists- Show all monitored playlists/stats- View bot statistics
/addplaylist- Add a new Spotify playlist to monitor/removeplaylist- Remove a playlist from monitoring/checkplaylists- Manually trigger playlist check (bypass 6-hour timer)
- Send
/addplaylistto the bot - Send the Spotify playlist URL:
https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M - Send a friendly name for the playlist:
My Favorite Mix - Bot will confirm and start monitoring!
Send /listplaylists to see all monitored playlists:
📋 پلیلیستهای ثبت شده:
1. 🎵 My Favorite Mix
📊 تعداد آهنگ: 50
🕐 آخرین چک: 2025-01-15 14:30
🔗 https://open.spotify.com/playlist/...
2. 🎵 Chill Vibes
📊 تعداد آهنگ: 32
🕐 آخرین چک: 2025-01-15 14:32
🔗 https://open.spotify.com/playlist/...
- Send
/removeplaylist - Bot shows numbered list of playlists
- Reply with the number of playlist to remove
docker-compose logs -fdocker-compose restartgit pull
docker-compose down
docker-compose build --no-cache
docker-compose up -d# Backup all persistent data
tar -czf backup-$(date +%Y%m%d).tar.gz data/ downloads/ deemix-config/docker-compose down -v
rm -rf data/ downloads/ deemix-config/.
├── bot.py # Main bot application
├── SpotifyApiCall.py # Spotify API wrapper
├── DeezerApiCall.py # Deezer/Deemix wrapper
├── requirements.txt # Python dependencies
├── Dockerfile # Docker image definition
├── docker-compose.yml # Docker Compose configuration
├── .env # Environment variables (create from .env.example)
├── .env.example # Environment variables template
├── data/ # Persistent bot data
│ ├── config.json # Playlists configuration
│ └── tracks_database.json # Tracks database
├── downloads/ # Downloaded music files
└── deemix-config/ # Deemix configuration
└── .arl # Deezer authentication token
Edit data/config.json:
{
"settings": {
"check_interval": 21600, // 6 hours in seconds (change as needed)
"bitrate": "128", // Audio quality (128, 320)
"download_dir": "./downloads"
}
}Free Deezer accounts support up to 128kbps. Premium accounts can use:
128- Standard quality (free accounts)320- High quality (premium accounts)
Change in config.json or set default in bot code.
# Check if container is running
docker ps
# Check logs for errors
docker-compose logs -f
# Restart bot
docker-compose restartDeezer ARL tokens can expire. To update:
# Stop bot
docker-compose down
# Remove old token
rm deemix-config/.arl
# Get new token from deezer.com (F12 → Cookies)
echo "your_new_arl_token" > deemix-config/.arl
# Start bot
docker-compose up -d# Check deemix configuration
docker-compose exec spotify-telegram-bot cat /root/.config/deemix/.arl
# Test deemix manually
docker-compose exec spotify-telegram-bot deemix https://www.deezer.com/track/123456789
# Check logs
docker-compose logs -f | grep -i error# Fix permissions on data directories
sudo chown -R $USER:$USER data/ downloads/ deemix-config/
chmod -R 755 data/ downloads/ deemix-config/- Verify bot is admin in the channel
- Check
CHANNEL_IDis correct (should start with-100) - Ensure bot has permission to send audio files
- Memory Usage: ~200-500MB
- CPU Usage: Low (spikes during downloads)
- Storage: Depends on music library size
- Network: Downloads audio files, minimal API calls
- Never commit
.envfile - Contains sensitive tokens - Use strong admin verification - Only trusted user IDs in
ADMIN_IDS - Regular backups - Backup
data/directory regularly - Update dependencies - Keep Docker images and packages updated
- Monitor logs - Check for unauthorized access attempts
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is for educational purposes. Ensure you comply with:
- Spotify Terms of Service
- Deezer Terms of Service
- Telegram Bot API Terms
- Copyright laws in your jurisdiction
This bot is for personal use only. Downloading copyrighted content may be illegal in your country. Use responsibly and respect artists' rights.
- Issues: Open an issue on GitHub
- Questions: Check existing issues or create new one
- Updates: Star the repo to get notifications
- Add support for YouTube Music
- Playlist scheduling (different check intervals per playlist)
- Multiple channel support
- Web dashboard for management
- User analytics and listening stats
- Automatic playlist creation based on genres
Made with ❤️ by developers who love music automation