You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
diff --git a/cover_grabber/downloader/lastfm_downloader.py b/cover_grabber/downloader/lastfm_downloader.py
index fec1433..dbae57f 100644
--- a/cover_grabber/downloader/lastfm_downloader.py
+++ b/cover_grabber/downloader/lastfm_downloader.py
@@ -14,10 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import urllib
-try:
- import xml.etree.cElementTree as ETree
-except:
- import xml.etree.ElementTree as ETree
+from lxml import etree as ETree
from cover_grabber.logging.config import logger
@@ -42,7 +39,8 @@ class LastFMDownloader(object):
logger.info(u'LastFM: Searching for "{artist_name} - {album_name}"'.format(artist_name=self.artist_name, album_name=self.album_name))
response = urllib.urlopen(self.url).read() # Send HTTP request to LastFM
- xml_data = ETree.fromstring(response) # Read in XML data
+ parser = ETree.XMLParser(recover=True)
+ xml_data = ETree.fromstring(response, parser) # Read in XML data
for element in xml_data.getiterator("album"):
if (element.find('artist').text.lower() == self.artist_name.lower().encode("utf-8")):
The real bug here is that I don't have much to go on for debugging or troubleshooting.
Bonus feature requesting a "--verbose" switch here, too, which could be a good thing to have as well as a better error message.
The text was updated successfully, but these errors were encountered: