From 5486f7f8d10e8f4b4da5e7bd617adc9946b8ac02 Mon Sep 17 00:00:00 2001 From: lars Date: Tue, 8 Nov 2022 22:35:40 +0100 Subject: [PATCH] bugfix try catche request in musify --- notes.md | 1 + src/scraping/musify.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/notes.md b/notes.md index c1d1144..24a47e7 100644 --- a/notes.md +++ b/notes.md @@ -1,4 +1,5 @@ # TO DO +- LYRICS - add complete search of musify (scraping of artist page etc.) as last resort - add a check if the songs truly are the same with non changebal attributes (length etc.) - get additional ISRCs diff --git a/src/scraping/musify.py b/src/scraping/musify.py index 1d68ffb..b4719bc 100644 --- a/src/scraping/musify.py +++ b/src/scraping/musify.py @@ -29,7 +29,10 @@ def get_musify_url(row): url = f"https://musify.club/search/suggestions?term={artists[0]} - {title}" - r = session.get(url=url) + try: + r = session.get(url=url) + except requests.exceptions.ConnectionError: + return None if r.status_code == 200: autocomplete = r.json() for row in autocomplete: