From a44c4491aa0cded1c1f7aaf70f4f0c970bcf19f5 Mon Sep 17 00:00:00 2001 From: Chris Norman Date: Thu, 22 Mar 2018 20:03:08 +0000 Subject: [PATCH] Added default parsers. --- PyLyrics/functions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PyLyrics/functions.py b/PyLyrics/functions.py index e4c7e19..3be63fe 100644 --- a/PyLyrics/functions.py +++ b/PyLyrics/functions.py @@ -41,7 +41,7 @@ class PyLyrics: @staticmethod def getAlbums(singer): singer = singer.replace(' ', '_') - s = BeautifulSoup(requests.get('http://lyrics.wikia.com/{0}'.format(singer)).text) + s = BeautifulSoup(requests.get('http://lyrics.wikia.com/{0}'.format(singer)).text, features='html.parser') spans = s.findAll('span',{'class':'mw-headline'}) als = [] @@ -60,7 +60,7 @@ def getAlbums(singer): @staticmethod def getTracks(album): url = "http://lyrics.wikia.com/api.php?action=lyrics&artist={0}&fmt=xml".format(album.artist()) - soup = BeautifulSoup(requests.get(url).text) + soup = BeautifulSoup(requests.get(url).text, features='html.parser') for al in soup.find_all('album'): if al.text.lower().strip() == album.name.strip().lower(): @@ -75,7 +75,7 @@ def getLyrics(singer, song): singer = singer.replace(' ', '_') song = song.replace(' ', '_') r = requests.get('http://lyrics.wikia.com/{0}:{1}'.format(singer,song)) - s = BeautifulSoup(r.text) + s = BeautifulSoup(r.text, features='html.parser') #Get main lyrics holder lyrics = s.find("div",{'class':'lyricbox'}) if lyrics is None: