diff --git a/Attrap_pref39.py b/Attrap_pref39.py index cde5ebcc46e7f7faf40b1429fd6e06e46d0d159f..ac2fb77a9125223b3703bf0bdcf2d08e043a6466 100644 --- a/Attrap_pref39.py +++ b/Attrap_pref39.py @@ -88,14 +88,10 @@ class Attrap_pref39(Attrap): url = unquote(url) name = a.get_text().strip() date_str = name.strip('RAA-39-').split(" ")[0] - try: - date_str = date_str.strip('_') - date = datetime.datetime.strptime(date_str, '%Y-%m-0%d') - except Exception: - date = datetime.datetime.strptime(date_str, '%Y_%m_0%d') - + try: + date = datetime.datetime.strptime(date_str.strip('_'), '%Y-%m-0%d') + except ValueError: + date = datetime.datetime.strptime(date_str.strip('_'), '%Y_%m_0%d') raa = Attrap.RAA(url, date, name) elements.append(raa) - else: - print("Didn't find a link!!") return elements