From 78f0721bb0b730a71a9d90e542b537655869f011 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 25 Sep 2022 06:37:16 +0200 Subject: [PATCH] fix --- files/routes/static.py | 50 +++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/files/routes/static.py b/files/routes/static.py index c790d1148..7d1643330 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -460,31 +460,35 @@ if SITE == 'pcmemes.net': t = offline_regex.search(text) y = offline_details_regex.search(text) - quantity = int(y.group(1)) - unit = y.group(2) + if y: + quantity = int(y.group(1)) + unit = y.group(2) - if unit.startswith('minu'): - unit = 'minute' - modifier = 1 - if unit == 'uur': - unit = 'hour' - modifier = 60 - if unit.startswith('we'): - unit = 'week' - modifier = 10080 - elif unit.startswith('maand'): - unit = 'month' - modifier = 43800 - elif unit == 'jaar': - unit = 'year' - modifier = 525600 + if unit.startswith('minu'): + unit = 'minute' + modifier = 1 + if unit == 'uur': + unit = 'hour' + modifier = 60 + if unit.startswith('we'): + unit = 'week' + modifier = 10080 + elif unit.startswith('maand'): + unit = 'month' + modifier = 43800 + elif unit == 'jaar': + unit = 'year' + modifier = 525600 + else: + print(unit, flush=True) + + minutes = quantity * modifier + + actual = f'{quantity} {unit}' + if quantity > 1: actual += 's' else: - print(unit, flush=True) - - minutes = quantity * modifier - - actual = f'{quantity} {unit}' - if quantity > 1: actual += 's' + minutes = 0 + actual = '???' try: return_val = (False, (id, req.url.rstrip('/live'), t.group(2), t.group(1), minutes, actual, y.group(3)))