Skip to content

Commit

Permalink
Return None in case of not expected result
Browse files Browse the repository at this point in the history
Fixes #52
  • Loading branch information
moehmeni committed Jul 28, 2024
1 parent bc97f85 commit 851ef0e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions syncedlyrics/providers/musixmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ def get_lrc(self, search_term: str) -> Optional[Lyrics]:
self.logger.warning(f"Got status code {status_code} for {search_term}")
return None
body = r.json()["message"]["body"]
if not isinstance(body, dict):
return None
tracks = body["track_list"]
cmp_key = lambda t: f"{t['track']['track_name']} {t['track']['artist_name']}"
track = get_best_match(tracks, search_term, cmp_key)
Expand Down

0 comments on commit 851ef0e

Please sign in to comment.