diff --git a/redbot/cogs/streams/errors.py b/redbot/cogs/streams/errors.py index 732b146d9f5..c9a31f43186 100644 --- a/redbot/cogs/streams/errors.py +++ b/redbot/cogs/streams/errors.py @@ -31,5 +31,9 @@ class YoutubeQuotaExceeded(StreamsError): pass +class YoutubeStreamNotFound(StreamsError): + pass + + class OfflineStream(StreamsError): pass diff --git a/redbot/cogs/streams/streamtypes.py b/redbot/cogs/streams/streamtypes.py index 659e135f935..693902a1d6c 100644 --- a/redbot/cogs/streams/streamtypes.py +++ b/redbot/cogs/streams/streamtypes.py @@ -20,6 +20,7 @@ InvalidYoutubeCredentials, StreamNotFound, YoutubeQuotaExceeded, + YoutubeStreamNotFound, ) from redbot.core.i18n import Translator from redbot.core.utils.chat_formatting import humanize_number, humanize_timedelta @@ -209,6 +210,8 @@ async def is_online(self): async with aiohttp.ClientSession() as session: async with session.get(YOUTUBE_VIDEOS_ENDPOINT, params=params) as r: data = await r.json() + if len(data["items"]) == 0: + raise YoutubeStreamNotFound() return await self.make_embed(data) raise OfflineStream()