gmusicapi
gmusicapi copied to clipboard
Mobileclient v2.1 - Top Charts
New API-Url https://mclients.googleapis.com/sj/v2.1/
Top Charts content can be retrieved via:
sj_url + browse/topchart
sj_url + browse/topchartgenres
sj_url + browse/topchartforgenre/<genre>
Original response (stripped-down) -> browse/topchart
{
"header":{
"kind":"sj#topChartHeader",
"header_image":{
"url":"http://lh3.googleusercontent.com/...",
"kind":"sj#imageRef",
"aspectRatio":"5",
"autogen":true
}
},
"chart":{
"kind":"sj#topChart",
"albums":[
{
"kind": "sj#album",
"description_attribution": {
"kind": "sj#attribution"
},
"name": "x (Deluxe Edition)",
"artist": "Ed Sheeran",
"albumArtRef": "http://lh3.ggpht.com/....",
"albumId": "B4juzw6upsachmokmtumqaxqlbu",
"artistId": [
"Aelpv6xw456fdtfl3yf3nkdzdwq"
],
"albumArtist": "Ed Sheeran",
"year": 2014
}
],
"tracks":[
{
"rating": "5",
"albumArtRef": [
{
"url": "http://lh3.ggpht.com/...",
"kind": "sj#imageRef",
"aspectRatio": "1",
"autogen": false
}
],
"lastRatingChangeTimestamp": "1431090211558000",
"artistId": [
"Abil363va3afa6gakni2ao3wsfe",
"Aitvi3tmkyj5k3ojioa5pcues7q"
],
"composer": "",
"year": 2014,
"trackAvailableForSubscription": true,
"trackType": "7",
"album": "Firestone",
"title": "Firestone (feat. Conrad Sewell)",
"albumArtist": "Kygo feat. Conrad Sewell",
"trackNumber": 1,
"discNumber": 1,
"albumAvailableForPurchase": true,
"contentType": "2",
"trackAvailableForPurchase": true,
"storeId": "Tqthk5djom4rkgucdxsbxva3lfe",
"nid": "Tqthk5djom4rkgucdxsbxva3lfe",
"estimatedSize": "10949512",
"albumId": "Bbafkoy5vet6mrkzt2h5oejtiyu",
"genre": "Pop",
"playCount": 16,
"kind": "sj#track",
"artist": "Kygo",
"lastModifiedTimestamp": "1442846408635430",
"durationMillis": "273000"
}
]
}
}
Proof-of-Concept implementation
#protocol/mobileclient.py
class GetTopChart(McCall):
static_params = {'alt': 'json'}
static_method = 'GET'
static_url = sj_url + 'browse/topchart'
#clients/mobileclient.py
...
def get_top_chart(self):
res = self._make_call(mobileclient.GetTopChart)
return res['chart']
...
Original response (stripped-down) -> browse/topchartgenres
{
"genres": [
{
"kind": "sj#genreRef",
"id": "DANCE_ELECTRONIC",
"title": "Dance/Electronic"
}
]
}
Proof-of-Concept implementation
#protocol/mobileclient.py
class GetTopChartGenres(McCall):
static_params = {'alt': 'json'}
static_method = 'GET'
static_url = sj_url + 'browse/topchartgenres'
#clients/mobileclient.py
...
def get_top_chart_genres(self):
return self._make_call(mobileclient.GetTopChartGenres)
...
Original response (stripped-down) -> browse/topchartforgenre/DANCE_ELECTRONIC
{
"header": {
"kind": "sj#topChartHeader",
"header_image": {
"url": "http://lh3.googleusercontent.com/iXLfKNN3ELpMtBJTAzcpF5RiVIhiu6iSIqZMnbKe2tBaz3WQk96b1P46",
"kind": "sj#imageRef",
"aspectRatio": "5",
"autogen": true
}
},
"chart": {
"kind": "sj#topChart",
"albums": [
{
"kind": "sj#album",
"description_attribution": {
"kind": "sj#attribution"
},
"name": "Skrillex and Diplo present Jack \u00dc",
"artist": "Jack \u00dc",
"albumArtRef": "http://lh3.googleusercontent.com/...",
"albumId": "Bsv3afibtnqmpw2tosxmf6izz5a",
"artistId": [
"Athmnlh45o6m7he6oyq54x6inhm",
"Aqy2vtuiohb4rdrakrtbphxbdme"
],
"albumArtist": "Jack \u00dc",
"year": 2015
}
],
"tracks": [
{
"rating": "1",
"albumArtRef": [
{
"url": "http://lh3.ggpht.com/...",
"kind": "sj#imageRef",
"aspectRatio": "1",
"autogen": false
}
],
"lastRatingChangeTimestamp": "1442845198251000",
"artistId": [
"A2uwlngbrtcqimcafrfflzntjym"
],
"composer": "",
"year": 2014,
"trackAvailableForSubscription": true,
"trackType": "7",
"album": "Goodbye (feat. Lyse) [Radio Edit]",
"title": "Goodbye (feat. Lyse) [Radio Edit]",
"albumArtist": "Feder",
"trackNumber": 1,
"discNumber": 1,
"albumAvailableForPurchase": true,
"contentType": "2",
"trackAvailableForPurchase": true,
"storeId": "Tjgc6nkte3itlksii7a2cre2f5m",
"nid": "Tjgc6nkte3itlksii7a2cre2f5m",
"estimatedSize": "8080223",
"albumId": "Bqchzlj4iikufornu5h5v7twsbe",
"genre": "Dance/Electronic",
"playCount": 4,
"kind": "sj#track",
"artist": "Feder",
"lastModifiedTimestamp": "1442845198326260",
"durationMillis": "201000"
}
]
}
}
Proof-of-Concept implementation
#protocol/mobileclient.py
class GetTopChartForGenre(McCall):
static_params = {'alt': 'json'}
static_method = 'GET'
@staticmethod
def dynamic_url(genre):
return sj_url + 'browse/topchartforgenre/' + genre
#clients/mobileclient.py
...
def get_top_chart_for_genre(self, genre):
return self._make_call(mobileclient.GetTopChartForGenre, genre)
...