Fix falso positive lyric pages for Tekstowo

This commit is contained in:
Xavier Hocquet 2021-04-11 17:30:45 -05:00
parent 2fa2d1b4ee
commit 31f4df3ff3

View file

@ -416,12 +416,16 @@ class Tekstowo(Backend):
def fetch(self, artist, title):
url = self.build_url(title, artist)
print(url)
search_results = self.fetch_url(url)
song_page_url = self.parse_search_results(search_results)
if not song_page_url:
return None
print('--------------------')
print(song_page_url)
song_page_html = self.fetch_url(song_page_url)
return self.extract_lyrics(song_page_html)
@ -437,8 +441,14 @@ class Tekstowo(Backend):
except HTMLParseError:
return None
song_row = html.find("div", class_="content"). \
find_all("div", class_="box-przeboje")[0]
song_rows = html.find("div", class_="content"). \
find("div", class_="card"). \
find_all("div", class_="box-przeboje")
if len(song_rows) < 1:
return None
song_row = song_rows[0]
if not song_row:
return None