瀏覽代碼

Fix bug in artist and album lookup

Colin Powell 2 年之前
父節點
當前提交
00aa2e892f
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      vrobbler/apps/scrobbles/theaudiodb.py

+ 4 - 0
vrobbler/apps/scrobbles/theaudiodb.py

@@ -1,3 +1,4 @@
+import urllib
 import json
 import logging
 
@@ -13,6 +14,7 @@ logger = logging.getLogger(__name__)
 
 def lookup_artist_from_tadb(name: str) -> dict:
     artist_info = {}
+    name = urllib.parse.quote(name)
     response = requests.get(ARTIST_SEARCH_URL + name)
 
     if response.status_code != 200:
@@ -37,6 +39,8 @@ def lookup_artist_from_tadb(name: str) -> dict:
 
 def lookup_album_from_tadb(name: str, artist: str) -> dict:
     album_info = {}
+    artist = urllib.parse.quote(artist)
+    name = urllib.parse.quote(name)
     response = requests.get(''.join([ALBUM_SEARCH_URL, artist, "&a=", name]))
 
     if response.status_code != 200: