[Streams] Attempt to fix unclear error in youtubestream (#4148)

This commit is contained in:
Jamie 2020-08-05 19:39:28 +01:00 committed by GitHub
parent c673bb0979
commit 0cc04706f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,6 +190,12 @@ class YoutubeStream(Stream):
raise StreamNotFound() raise StreamNotFound()
elif "items" in data: elif "items" in data:
return data["items"][0][resource] return data["items"][0][resource]
elif (
"pageInfo" in data
and "totalResults" in data["pageInfo"]
and data["pageInfo"]["totalResults"] < 1
):
raise StreamNotFound()
raise APIError() raise APIError()
def __repr__(self): def __repr__(self):