Ensure the Picarto channel is given when checking online
This commit is contained in:
parent
8ff72f07bd
commit
caa3854dc2
|
@ -28,6 +28,9 @@ class Picarto:
|
||||||
self.online_channels = await utils.request(url, payload=payload)
|
self.online_channels = await utils.request(url, payload=payload)
|
||||||
|
|
||||||
async def channel_embed(self, channel):
|
async def channel_embed(self, channel):
|
||||||
|
# First make sure the picarto URL is actually given
|
||||||
|
if not channel:
|
||||||
|
return None
|
||||||
# Use regex to get the actual username so that we can make a request to the API
|
# Use regex to get the actual username so that we can make a request to the API
|
||||||
stream = re.search("(?<=picarto.tv/)(.*)", channel).group(1)
|
stream = re.search("(?<=picarto.tv/)(.*)", channel).group(1)
|
||||||
url = BASE_URL + '/channel/name/{}'.format(stream)
|
url = BASE_URL + '/channel/name/{}'.format(stream)
|
||||||
|
|
Loading…
Reference in a new issue