A userscript that automatically embeds Spotify players on Discogs release and master pages, making it easy to listen to albums while browsing Discogs.
This extension enhances your Discogs browsing experience by automatically finding and embedding Spotify players for the albums you're viewing. When you visit a release or master page on Discogs, the extension:
- Extracts the artist and album information from the page
- Searches Spotify for matching content using a smart matching algorithm
- Embeds a Spotify player directly on the page if a match is found
- Provides a clean, unobtrusive interface that integrates with Discogs' design
- Automatic Detection: Intelligently extracts release and artist information from Discogs pages
- Smart Matching: Uses a sophisticated algorithm to find the correct album on Spotify, even with slight naming differences
- Embedded Players: Seamlessly integrates Spotify players directly in the Discogs page
- Various Artists Support: Special handling for compilations and "Various Artists" releases
- Edge Case Handling: Attempts to handle different naming formats, special characters, and other edge cases
- Authentication Management: Manages Spotify authentication tokens securely
- Responsive Design: Clean UI that matches Discogs' style and works across different screen sizes
First, you need a userscript manager extension for your browser:
- Chrome/Edge: Tampermonkey (recommended)
- Firefox: Tampermonkey or Greasemonkey
- Safari: Tampermonkey
You'll need your own Spotify API credentials:
- Go to the Spotify Developer Dashboard
- Log in with your Spotify account
- Click "Create an App"
- Fill in the app name (e.g., "My Discogs Spotify Extension") and description
- Check the terms of service and click "Create"
- In your new app's dashboard, click "Edit Settings"
- Under "Redirect URIs", add:
https://www.discogs.com/callback
- Save the settings
- On the app dashboard, note your "Client ID" (you'll need this in the next step)
- Click on the raw script file in this repository or copy its contents
- Open your userscript manager (e.g., click the Tampermonkey icon and select "Create a new script")
- Paste the script code into the editor
- Find the line that says
clientId: 'Your Spotify Client ID'
(around line 32) - Replace
'Your Spotify Client ID'
with your actual Spotify Client ID from step 2, keeping the quotes (e.g.,clientId: '1a2b3c4d5e6f7g8h9i0j'
) - Save the script (Ctrl+S or File > Save)
- Make sure the script is enabled in your userscript manager
- Go to any Discogs release page or master page
- You should see either:
- A Spotify player at the top of the page if the album was found
- A "Connect Spotify to View Player" button if you need to authorize the application
- A message saying "Album not found on Spotify" if no match was found
- Browse to any release or master page on Discogs
- The first time you use the extension, click "Connect Spotify to View Player"
- You'll be redirected to Spotify to authorize the application
- After authorization, you'll be redirected back to Discogs
- The extension will automatically search for and display the Spotify player
- The player allows you to:
- Play the album directly on the page
- Control playback (play, pause, skip)
- Click through to open the album in Spotify
- No player appears: Make sure the script is enabled in your userscript manager
- "Album not found": The album might not be available on Spotify or the matching algorithm couldn't find it
- Authentication errors: Try clicking the "Connect Spotify" button again, or clear your browser cookies and retry
- Script errors: Check your browser console for error messages
The Spotify authentication token expires after 50 minutes. The extension will automatically prompt you to reconnect when needed.
The script requires several permissions to function properly:
GM_xmlhttpRequest
: Allows the script to make API calls to SpotifyGM_addStyle
: Enables adding custom CSS styles to the pageGM_setValue/GM_getValue
: Used for storing authentication data between sessionsGM_openInTab
: Required for the Spotify authentication processGM_deleteValue
: Used to clear expired authentication tokens
The extension uses a sophisticated matching algorithm that:
- Extracts artist and album title from the Discogs page
- Cleans up the text by removing common words, special characters, etc.
- Uses multiple search strategies with the Spotify API
- Calculates similarity scores between Discogs and Spotify results
- Applies different matching thresholds based on the type of release
Contributions are welcome! Here's how you can help:
- Report bugs: If you find an issue, please open an issue with details
- Suggest features: Have an idea? Share it in the issues section
- Submit code: Fork the repository, make your changes, and submit a pull request
- Improve documentation: Help make these instructions clearer
- Fork and clone the repository
- Make your changes to the script
- Test thoroughly with different types of Discogs pages
- Submit a pull request with a clear description of your changes
This project is licensed under the MIT License - see the LICENSE file for details.
Created by w-y-a-t-t
If you encounter any issues or have suggestions, please open an issue on GitHub.
This extension:
- Only accesses data on Discogs release and master pages
- Only communicates with the Spotify API
- Stores authentication tokens locally in your browser
- Does not collect any personal data
- Does not track your browsing activity
When connecting to Spotify, you'll be redirected to Spotify's authorization page. After granting permission, you'll briefly see a loading screen while the authentication completes, and then you'll be automatically redirected back to the Discogs page you were viewing.