Skip to content

Commit

Permalink
Handle ["broadcaster": null] response from Twitch
Browse files Browse the repository at this point in the history
  • Loading branch information
Arne-Weber committed Jun 12, 2024
1 parent 7aa8413 commit 7709943
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions twitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1746,10 +1746,13 @@ async def get_live_streams(self, game: Game, *, limit: int = 30) -> list[Channel
except MinerException as exc:
raise MinerException(f"Game: {game.slug}") from exc
if "game" in response["data"]:
return [
Channel.from_directory(self, stream_channel_data["node"], drops_enabled=True)
for stream_channel_data in response["data"]["game"]["streams"]["edges"]
]
streams = []
for stream_channel_data in response["data"]["game"]["streams"]["edges"]:
if stream_channel_data["node"]["broadcaster"]:
streams.append(Channel.from_directory(self, stream_channel_data["node"], drops_enabled=True))
else:
self.gui.print(f'Could not load Channel for {stream_channel_data["node"]["game"]["name"]}.\n↳ Stream Title: "{stream_channel_data["node"]["title"]}"')
return streams
return []

async def claim_points(self, channel_id: str | int, claim_id: str) -> None:
Expand Down

0 comments on commit 7709943

Please sign in to comment.