### Install musicxmatch-api Package Source: https://github.com/strvm/musicxmatch-api/blob/main/README.md This command installs the musicxmatch_api Python package using pip. Ensure you have Python and pip installed on your system. ```bash pip install musicxmatch_api ``` -------------------------------- ### Get Album Tracks with MusicXMatch API Source: https://context7.com/strvm/musicxmatch-api/llms.txt Retrieves all tracks from a specific album using the MusixMatchAPI. Requires an album ID and supports pagination. The output is a list of tracks, each containing track name and ID. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get tracks from an album tracks_data = api.get_album_tracks(album_id=14250417, page=1) tracks = tracks_data["message"]["body"]["track_list"] for track in tracks: track_info = track["track"] print(f"Track: {track_info['track_name']}") print(f"Track ID: {track_info['track_id']}") print("---") ``` -------------------------------- ### Get Artist Chart with MusicXMatch API Source: https://context7.com/strvm/musicxmatch-api/llms.txt Fetches the top artists chart for a specified country. Requires a country code and supports pagination. The function returns a list of artists, displaying their names. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get top artists in the US chart_data = api.get_artist_chart(country="US", page=1) artists = chart_data["message"]["body"]["artist_list"] for i, artist in enumerate(artists[:10], 1): artist_info = artist["artist"] print(f"{i}. {artist_info['artist_name']}") ``` -------------------------------- ### Get Album Details using MusicXMatch API in Python Source: https://context7.com/strvm/musicxmatch-api/llms.txt Retrieves detailed information about a specific album using its album ID. The output includes the album name, artist name, track count, and release date. Requires the musicxmatch_api library. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get album by ID album_data = api.get_album(album_id=14250417) album = album_data["message"]["body"]["album"] print(f"Album: {album['album_name']}") print(f"Artist: {album['artist_name']}") print(f"Track Count: {album['album_track_count']}") print(f"Release Date: {album['album_release_date']}") ``` -------------------------------- ### Get Artist Albums using MusicXMatch API in Python Source: https://context7.com/strvm/musicxmatch-api/llms.txt Fetches a list of all albums by a specific artist, identified by their Musixmatch artist ID. Supports pagination and includes album name, ID, and release date. Requires the musicxmatch_api library. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get albums for an artist albums_data = api.get_artist_albums(artist_id=410698, page=1) albums = albums_data["message"]["body"]["album_list"] for album in albums: album_info = album["album"] print(f"Album: {album_info['album_name']}") print(f"Album ID: {album_info['album_id']}") print(f"Release Date: {album_info.get('album_release_date', 'Unknown')}") print("---") ``` -------------------------------- ### Get Track Lyrics using MusicXMatch API in Python Source: https://context7.com/strvm/musicxmatch-api/llms.txt Fetches the lyrics for a given track, identifiable by its track ID or ISRC code. The response includes the lyrics body and copyright information. Requires the musicxmatch_api library. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get lyrics by track ID lyrics_data = api.get_track_lyrics(track_id=103149239) # Skyfall by Adele # Extract the lyrics text lyrics = lyrics_data["message"]["body"]["lyrics"]["lyrics_body"] print(lyrics) # Check lyrics copyright copyright_info = lyrics_data["message"]["body"]["lyrics"]["lyrics_copyright"] print(f"Copyright: {copyright_info}") ``` -------------------------------- ### Get Track Lyrics Translation with MusicXMatch API Source: https://context7.com/strvm/musicxmatch-api/llms.txt Fetches translated lyrics for a specific track in a desired language. This requires a track ID and the target language code. The result provides snippets and descriptions of the translations. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get Spanish translation of lyrics translation_data = api.get_track_lyrics_translation( track_id=103149239, selected_language="es" ) translations = translation_data["message"]["body"]["translations_list"] for translation in translations: trans = translation["translation"] print(f"Original: {trans.get('snippet', 'N/A')}") print(f"Translation: {trans.get('description', 'N/A')}") print("---") ``` -------------------------------- ### Get Track Richsync Lyrics with MusicXMatch API Source: https://context7.com/strvm/musicxmatch-api/llms.txt Retrieves word-by-word synchronized lyrics (richsync) for a track. It supports filtering by sync length and deviation. Data can be fetched using track ID, ISRC, or commontrack_id. ```python from musicxmatch_api import MusixMatchAPI import json api = MusixMatchAPI() # Get richsync data by track ID richsync_data = api.get_track_richsync(track_id=103149239) # Or by commontrack_id or ISRC richsync_data = api.get_track_richsync( track_isrc="GBUM71200767", f_richsync_length="200", f_richsync_length_max_deviation="10" ) richsync = richsync_data["message"]["body"]["richsync"] richsync_body = json.loads(richsync["richsync_body"]) # Each entry contains timing and word-level sync data for line in richsync_body[:5]: print(f"Time: {line['ts']}s - {line['x']}") ``` -------------------------------- ### Get Artist Details using MusicXMatch API in Python Source: https://context7.com/strvm/musicxmatch-api/llms.txt Retrieves detailed information about a specific artist using their Musixmatch artist ID. The output includes the artist's name, country, and Twitter URL if available. Requires the musicxmatch_api library. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get artist by ID artist_data = api.get_artist(artist_id=410698) # Adele artist = artist_data["message"]["body"]["artist"] print(f"Name: {artist['artist_name']}") print(f"Country: {artist['artist_country']}") print(f"Twitter: {artist.get('artist_twitter_url', 'N/A')}") ``` -------------------------------- ### Get Track Details using MusicXMatch API in Python Source: https://context7.com/strvm/musicxmatch-api/llms.txt Retrieves detailed information for a specific track using either its track ID or ISRC code. The returned data includes comprehensive metadata such as album information, genres, and track statistics. Requires the musicxmatch_api library. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get track by ID track_data = api.get_track(track_id=15953433) # Or get track by ISRC track_data = api.get_track(track_isrc="GBAYE0601713") track = track_data["message"]["body"]["track"] print(f"Track Name: {track['track_name']}") print(f"Artist: {track['artist_name']}") print(f"Album: {track['album_name']}") print(f"Duration: {track['track_length']} seconds") ``` -------------------------------- ### Get Track Chart with MusicXMatch API Source: https://context7.com/strvm/musicxmatch-api/llms.txt Retrieves the top tracks chart for a given country. This function requires a country code and supports pagination. The output lists the track name and artist name for the top tracks. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Get top tracks in the UK chart_data = api.get_track_chart(country="GB", page=1) tracks = chart_data["message"]["body"]["track_list"] for i, track in enumerate(tracks[:10], 1): track_info = track["track"] print(f"{i}. {track_info['track_name']} - {track_info['artist_name']}") ``` -------------------------------- ### Get Specific Song Lyrics using MusixMatch API (Python) Source: https://github.com/strvm/musicxmatch-api/blob/main/README.md This Python code snippet retrieves the lyrics for a specific song using its track ID via the MusixMatch API wrapper. It initializes the API client, calls `get_track_lyrics`, and extracts the lyrics from the response. Using proxies is advised for frequent requests. ```python # If you need to make a high volume of requests, consider using proxies from musicxmatch_api import MusixMatchAPI track_id = 103149239 # Skyfall by Adele api = MusixMatchAPI(proxies=proxies) search = api.get_track_lyrics(track_id=track_id) # The lyrics are in the "lyrics_body" key lyrics = search["message"]["body"]["lyrics"]["lyrics_body"] ``` -------------------------------- ### Search for Artists using MusixMatch API (Python) Source: https://github.com/strvm/musicxmatch-api/blob/main/README.md This Python code snippet demonstrates how to search for artists using the MusixMatch API wrapper. It initializes the API client and calls the `search_artist` method with a query. Consider using proxies for high-volume requests. ```python # If you need to make a high volume of requests, consider using proxies from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI(proxies=proxies) search = api.search_artist("adele") ``` -------------------------------- ### Search for Songs using MusixMatch API (Python) Source: https://github.com/strvm/musicxmatch-api/blob/main/README.md This Python code snippet shows how to search for songs using the MusixMatch API wrapper. It imports the necessary library, initializes the API, and uses the `search_tracks` method. The results are printed in a formatted JSON string. Proxies are recommended for high request volumes. ```python # If you need to make a high volume of requests, consider using proxies import json from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() search = api.search_tracks("skyfall") print(json.dumps(search, indent=4)) ``` -------------------------------- ### Configure Proxy Support for MusicXMatch API Source: https://context7.com/strvm/musicxmatch-api/llms.txt Demonstrates how to configure proxy support for the MusixMatchAPI client. This is useful for managing high-volume requests and avoiding rate limiting by routing requests through specified HTTP or HTTPS proxies. ```python from musicxmatch_api import MusixMatchAPI # Configure proxies proxies = { "http": "http://proxy.example.com:8080", "https": "https://proxy.example.com:8080" } # Initialize API with proxies api = MusixMatchAPI(proxies=proxies) # All subsequent requests will use the proxy search = api.search_tracks("hello") ``` -------------------------------- ### Search Artists using MusicXMatch API in Python Source: https://context7.com/strvm/musicxmatch-api/llms.txt Searches for artists by name and returns a list of matching artists with their details, including ID, ratings, and social media links. Supports pagination. Requires the musicxmatch_api library. ```python from musicxmatch_api import MusixMatchAPI api = MusixMatchAPI() # Search for an artist artist_results = api.search_artist("adele", page=1) artists = artist_results["message"]["body"]["artist_list"] for artist in artists: artist_info = artist["artist"] print(f"Artist: {artist_info['artist_name']}") print(f"Artist ID: {artist_info['artist_id']}") print(f"Rating: {artist_info['artist_rating']}") print("---") ``` -------------------------------- ### Search Tracks using MusicXMatch API in Python Source: https://context7.com/strvm/musicxmatch-api/llms.txt Searches for tracks based on a query string and returns a list of matching tracks with their metadata. Supports pagination and indicates if lyrics are available for each track. Requires the musicxmatch_api library. ```python from musicxmatch_api import MusixMatchAPI import json api = MusixMatchAPI() # Search for tracks matching a query search_results = api.search_tracks("hey jude", page=1) # Access the track list tracks = search_results["message"]["body"]["track_list"] for track in tracks: track_info = track["track"] print(f"Track: {track_info['track_name']} by {track_info['artist_name']}") print(f"Track ID: {track_info['track_id']}") print(f"Has Lyrics: {track_info['has_lyrics']}") print("---") # Example output: # Track: Hey Jude by The Beatles # Track ID: 15953433 # Has Lyrics: 1 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.