-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.py
77 lines (57 loc) · 1.77 KB
/
api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from musixmatch.album import Album
from musixmatch.artist import Artist
from musixmatch.chart import Chart
from musixmatch.track import Track
class Musixmatch(object):
"""Musixmatch API"""
BASE_URL = "http://api.musixmatch.com/ws"
VERSION = "1.1"
def __init__(self, api_key, **kwargs):
"""
Musixmatch Api Instance Constructor
:param kwargs:
"""
self.api_key = api_key
self.base_url = "%s/%s" % (self.BASE_URL, self.VERSION)
@property
def artist(self):
"""
Musixmatch Artist Operations
Available methods:
get: Get the artist data.
related: Get related artists.
search: Search for artists.
albums: Get the albums of an artist.
"""
return Artist(api=self)
@property
def album(self):
"""
Musixmatch Artist Operations
Available methods:
get: Get the album object using the Musixmatch id.
tracks: Get the songs of an album.
"""
return Album(api=self)
@property
def track(self):
"""
Musixmatch Track Operations
Available methods:
get: Get a song by Musixmatch id.
lyrics: Get the lyrics for given track.
lyrics_translation: Get a translated lyrics for a given language.
search: Search for tracks.
snippet: Get the snippet for a given track.
subtitle: Retrieve the subtitle of a track.
"""
return Track(api=self)
@property
def chart(self):
"""
Musixmatch Track Operations
Available methods:
artist: Get the list of the top artists of a given country.
tracks: Get the list of the top songs of a given country.
"""
return Chart(api=self)