From 16364b1af8590f6a6caaf518656f0952d1395650 Mon Sep 17 00:00:00 2001 From: Leko Date: Fri, 19 Mar 2021 19:35:37 +0800 Subject: [PATCH] fix: typo --- utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils.py b/utils.py index df6ca3c..49d1148 100644 --- a/utils.py +++ b/utils.py @@ -44,11 +44,6 @@ def stop(self): def urlopen(url, retry = 0): try: return urllib.request.urlopen(url) - except urllib.error.URLError as e: - if retry < const.HTTP_RETRY: - return urlopen(url, retry + 1) - else: - raise e except urllib.error.HTTPError as e: if e.code == 503: if retry < const.HTTP_RETRY: @@ -59,6 +54,11 @@ def urlopen(url, retry = 0): raise e else: raise e + except urllib.error.URLError as e: + if retry < const.HTTP_RETRY: + return urlopen(url, retry + 1) + else: + raise e def is_live(channel_id): url = f"https://www.youtube.com/channel/{channel_id}/live"