Fix an issue with offline streams returning 404 and breaking send_watch
This commit is contained in:
1 parent
d7a26f67c1
commit
cffda7fc39
1 file changed
+3
@@ -391,6 +391,9 @@ class Channel:
|
|||||||
async with self._twitch.request(
|
async with self._twitch.request(
|
||||||
"GET", stream_url, headers={"Connection": "close"}
|
"GET", stream_url, headers={"Connection": "close"}
|
||||||
) as chunks_response:
|
) 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()
|
available_chunks = await chunks_response.text()
|
||||||
# the list contains ~10-13 chunks of the stream at 2s intervals,
|
# 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,
|
# pick the last chunk URL available. Ensure it's not the end-of-stream tag,
|
||||||
|
|||||||
Reference in new issue
Block a user