aboutsummaryrefslogtreecommitdiff
path: root/modules/lastfm.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-11-25 18:17:30 +0000
committerGravatar jesopo2019-11-25 18:17:30 +0000
commit6a6e789ec9e3c6dd365922ac630a405b830e8c1a (patch)
tree7e2e1675d7d1fab7d4240da83c0179076f89c938 /modules/lastfm.py
parentinclude <title> with !google/!g output (diff)
signature
add `cookies` and `.json()` to utils.http.Response objects
Diffstat (limited to 'modules/lastfm.py')
-rw-r--r--modules/lastfm.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/lastfm.py b/modules/lastfm.py
index 8bf7ebef..ce69abcf 100644
--- a/modules/lastfm.py
+++ b/modules/lastfm.py
@@ -40,11 +40,10 @@ class Module(ModuleManager.BaseModule):
page = utils.http.request(URL_SCROBBLER, get_params={
"method": "user.getrecenttracks", "user": lastfm_username,
"api_key": self.bot.config["lastfm-api-key"],
- "format": "json", "limit": "1"}, json=True)
+ "format": "json", "limit": "1"}).json()
if page:
- if ("recenttracks" in page.data and
- len(page.data["recenttracks"]["track"])):
- now_playing = page.data["recenttracks"]["track"]
+ if "recenttracks" in page and len(page["recenttracks"]["track"]):
+ now_playing = page["recenttracks"]["track"]
if type(now_playing) == list:
now_playing = now_playing[0]
@@ -70,9 +69,9 @@ class Module(ModuleManager.BaseModule):
"method": "track.getInfo", "artist": artist,
"track": track_name, "autocorrect": "1",
"api_key": self.bot.config["lastfm-api-key"],
- "user": lastfm_username, "format": "json"}, json=True)
+ "user": lastfm_username, "format": "json"}).json()
- track = info_page.data.get("track", {})
+ track = info_page.get("track", {})
tags_str = ""
if "toptags" in track and track["toptags"]["tag"]: