A simple, command-line chatbot built with Python that recommends music using the Last.fm API. This project allows users to discover new music based on their mood or find songs similar to their favorites.
- Recommend by Mood/Tag: Get a list of the top 10 most popular songs for any given tag (e.g., "happy", "rock", "80s").
- Find Similar Songs: Enter a song title and artist to get a list of 10 similar tracks.
- Interactive CLI: A user-friendly, menu-driven interface that runs in your terminal.
- Direct API Integration: Communicates directly with the Last.fm API using the
requestslibrary, without any third-party wrappers.
- Language: Python 3
- API: Last.fm API
- Core Library:
requestsfor making HTTP API calls.
Follow these instructions to set up and run the project on your local machine.
Make sure you have Python 3 installed on your system. You can download it from python.org.
Step 1: Get the Project Files
Download or clone the project files, which include:
chatbot.pyrequirements.txt
Step 2: Configure the Script
Open the chatbot.py file and paste your API key from Last.fm into the API_KEY variable.
# chatbot.py
# ... (documentation)
import requests
import sys
# --- CONFIGURATION ---
# TODO: Paste your Last.fm API key here.
API_KEY = "PASTE_YOUR_API_KEY_HERE" # <--- PASTE YOUR KEY HERE
BASE_URL = "[http://ws.audioscrobbler.com/2.0/](http://ws.audioscrobbler.com/2.0/)"
# ... (rest of the code)