Skip to content

Commit

Permalink
fix: retry count
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoOwO committed Mar 17, 2021
1 parent 07a7154 commit 9b74eea
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ def urlopen(url, retry = 0):
except urllib.error.HTTPError as e:
if e.code == 503:
if retry < const.HTTP_RETRY:
utils.warn(f" Get {e.code} Error. Trying {retry}/{const.HTTP_RETRY}...")
utils.warn(f" Get {e.code} Error. Trying {retry+1}/{const.HTTP_RETRY}...")
time.sleep(1)
return urlopen(url, retry+1)
else:
raise e
else:
raise e


def is_live(channel_id):
url = f"https://www.youtube.com/channel/{channel_id}/live"
with urlopen(url) as response:
Expand Down

0 comments on commit 9b74eea

Please sign in to comment.