“Python script to get notified of a random music to listen to, on Discord, using Spotify API and Discord Webhook.”
Open your Discord server.
Go to Server Settings > Integrations > Webhooks.
Click “New Webhook” and customize it as you like.
Copy the Webhook URL.
Create a Spotify Developer Account:
Go to the Spotify Developer Dashboard and log in with your Spotify account. Create a New Spotify App:
curl -X POST "https://accounts.spotify.com/api/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=your-client-id&client_secret=your-client-secret"
pip install requests
copy the python script and make a new python file song-notifier.py
Replace Placeholder Values
Open the song-notifier.py
file and replace
client_id
, client_secret
,access_token
and
YOUR_DISCORD_WEBHOOK_URL
you can always modify the genre e.g metal,rock,pop,rap,country e.t.c
, to get recommended, genre specified songs
crontab -e
0 */8 * * * /usr/bin/python /home/samsep10l/Desktop/song-notifier.py
crontab -l