Fix an issue with offline streams returning 404 and breaking send_watch

This commit is contained in:
DevilXD
2024-09-18 21:57:25 +02:00
parent d7a26f67c1
commit cffda7fc39

View File

@@ -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,