From cffda7fc392ce53a8f9099d948709dd7db50ce6b Mon Sep 17 00:00:00 2001 From: DevilXD <4180725+DevilXD@users.noreply.github.com> Date: Wed, 18 Sep 2024 21:57:25 +0200 Subject: [PATCH] Fix an issue with offline streams returning 404 and breaking send_watch --- channel.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/channel.py b/channel.py index 65b98cd..25b658d 100644 --- a/channel.py +++ b/channel.py @@ -391,6 +391,9 @@ class Channel: async with self._twitch.request( "GET", stream_url, headers={"Connection": "close"} ) as chunks_response: + if chunks_response.status >= 400: + # if the stream goes OFFLINE, trying to get a list of chunks returns a 404 + return False available_chunks = await chunks_response.text() # the list contains ~10-13 chunks of the stream at 2s intervals, # pick the last chunk URL available. Ensure it's not the end-of-stream tag,