A web application that allows users to search for artists and automatically add their top 5 songs to designated "incoming" playlists on Spotify. Built with Go, featuring a responsive web interface, REST API, and comprehensive security features.
- Artist Search: Fuzzy matching to find artists even with typos or variations
- Web Scraping Artist Discovery: Automatically extract and add artists from web pages (Reddit posts, music blogs, forums)
- Automatic Track Addition: Adds top 5 tracks from found artists to selected playlists
- Duplicate Detection: Prevents adding the same artist's tracks multiple times with override option
- Playlist Management: Works with playlists in your "Incoming" folder on Spotify
- Responsive Web Interface: Works seamlessly on desktop, tablet, and mobile devices
- Embedded Spotify Player: Listen to your playlists directly in the web interface
- REST API: Programmatic access for automation and integration
- CLI Commands: Command-line interface for scripting and automation
- Security Features: CSRF protection, rate limiting, input validation, and security headers
- Comprehensive Logging: Structured logging with multiple levels and HTTP request tracking
- Spotify Developer Account: Create an app at Spotify Developer Dashboard
- Go 1.21+: For building from source
make install# Download the latest release for your platform
wget https://github.com/toozej/go-listen/releases/latest/download/go-listen-linux-amd64
chmod +x go-listen-linux-amd64
mv go-listen-linux-amd64 go-listengit clone https://github.com/toozej/go-listen.git
cd go-listen
go build -o go-listen .-
Copy the sample environment file:
cp .env.sample .env
-
Edit
.envwith your Spotify credentials:# Required: Add your Spotify API credentials SPOTIFY_CLIENT_ID=your_spotify_client_id_here SPOTIFY_CLIENT_SECRET=your_spotify_client_secret_here # Optional: Customize server settings SERVER_HOST=localhost SERVER_PORT=8080
-
Start the application:
./go-listen serve
-
Open your browser to
http://localhost:8080
- Select a Playlist: Choose from your "Incoming" folder playlists using the searchable dropdown
- Search for an Artist: Enter an artist name (fuzzy matching handles typos)
- Add Tracks: Click "Add Artist" to add their top 5 tracks to the selected playlist
- Handle Duplicates: If tracks already exist, you'll get an option to add anyway
- Listen: Use the embedded Spotify player to listen to your updated playlist
Automatically discover and add artists from web pages:
- Enter a URL: Paste a link to a Reddit post, music blog, or forum discussion
- Optional CSS Selector: Target specific page sections (e.g.,
div.post-content) - Scrape & Add: The system extracts artist names, fuzzy matches them to Spotify, and adds their top 5 tracks
- Review Results: See which artists were successfully added, which failed, and which were duplicates
Example URLs:
- Reddit music recommendation threads
- Music blog "best of" lists
- Forum discussions about artists
- Concert lineup pages
# Scrape artists from a URL and add to playlist
go-listen scrape https://example.com/artists --playlist PLAYLIST_ID
# Use a CSS selector to target specific content
go-listen scrape https://reddit.com/r/music/... \
--selector "div[data-test-id='post-content']" \
--playlist PLAYLIST_ID
# Force add even if duplicates exist
go-listen scrape https://example.com/artists \
--playlist PLAYLIST_ID \
--forceSee REST API Documentation
| Variable | Default | Description |
|---|---|---|
SPOTIFY_CLIENT_ID |
- | Required: Your Spotify app client ID |
SPOTIFY_CLIENT_SECRET |
- | Required: Your Spotify app client secret |
SPOTIFY_REDIRECT_URL |
http://127.0.0.1:8080/callback |
Spotify OAuth redirect URL |
SERVER_HOST |
localhost |
Server bind address |
SERVER_PORT |
8080 |
Server port |
SCRAPER_TIMEOUT |
30s |
HTTP timeout for web scraping |
SCRAPER_MAX_RETRIES |
3 |
Max retry attempts for failed requests |
SCRAPER_RETRY_BACKOFF |
2s |
Initial backoff delay for retries |
SCRAPER_USER_AGENT |
go-listen/1.0 |
User agent for web requests |
SCRAPER_MAX_CONTENT_SIZE |
10485760 |
Max content size (10MB) |
SECURITY_RATE_LIMIT_REQUESTS_PER_SECOND |
10 |
Rate limit per IP |
SECURITY_RATE_LIMIT_BURST |
20 |
Rate limit burst capacity |
LOGGING_LEVEL |
info |
Log level (debug, info, warn, error) |
LOGGING_FORMAT |
json |
Log format (json, text) |
LOGGING_OUTPUT |
stdout |
Log output (stdout, stderr, file path) |
LOGGING_ENABLE_HTTP |
true |
Enable HTTP request logging |
Example configurations are provided in the configs/ directory:
configs/development.env- Development settings with verbose loggingconfigs/production.env- Production settings with optimized logging
docker run -d \
--name go-listen \
-p 8080:8080 \
-e SPOTIFY_CLIENT_ID=your_client_id \
-e SPOTIFY_CLIENT_SECRET=your_client_secret \
--restart unless-stopped \
toozej/go-listen:latestSee docs/deployment.md for detailed deployment instructions including systemd service setup, Kubernetes deployment, and reverse proxy configuration.
- Configuration Guide - Detailed configuration options and examples
- Deployment Guide - Production deployment instructions
- Development Guide - Local development instructions
- API Documentation - REST API reference
The application includes several security features:
- CSRF Protection: Prevents cross-site request forgery attacks
- Rate Limiting: Prevents abuse with configurable limits per IP
- Input Validation: Sanitizes and validates all user input
- Security Headers: Implements security headers (HSTS, CSP, etc.)
- Structured Logging: Comprehensive logging for security monitoring
For production deployment, consider:
- Running behind a reverse proxy with HTTPS
- Implementing additional authentication if needed
- Monitoring logs for security events
- Adjusting rate limits based on usage patterns