From 892acd6df9b30f8fbd7167e838249d0ff41044da Mon Sep 17 00:00:00 2001 From: Hugo Date: Thu, 5 Apr 2018 18:08:21 +0300 Subject: [PATCH] Artist charts have the artist name in the 'name' field. There is no 'artist' field. --- pylast/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index 13a8681..848c0df 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -1169,8 +1169,15 @@ class _Chartable(object): seq = [] for node in doc.getElementsByTagName(chart_kind.lower()): - item = chart_type( - _extract(node, "artist"), _extract(node, "name"), self.network) + if chart_kind == "artist": + item = chart_type( + _extract(node, "name"), + self.network) + else: + item = chart_type( + _extract(node, "artist"), + _extract(node, "name"), + self.network) weight = _number(_extract(node, "playcount")) seq.append(TopItem(item, weight))