Skip to content

Commit

Permalink
Fix an issue with offline streams returning 404 and breaking send_watch
Browse files Browse the repository at this point in the history
  • Loading branch information
DevilXD committed Sep 18, 2024
1 parent d7a26f6 commit cffda7f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ async def send_watch(self) -> bool:
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,
Expand Down

0 comments on commit cffda7f

Please sign in to comment.