def default(self, *, channel: "channel"):
"""Default response."""
response = await (await aiohttp.get(
"https://beam.pro/api/v1/channels/{}".format(channel)
)).json()
if "id" in response:
data = await (await aiohttp.get(
self.BEAM_MANIFEST_URL.format(channel=response["id"])
)).json()
if "startedAt" in data:
time = datetime.datetime.utcnow() - datetime.datetime.strptime(
data["startedAt"], "%Y-%m-%dT%H:%M:%S.%fZ")
time -= datetime.timedelta(microseconds=time.microseconds)
return "Channel has been live for {}.".format(time)
return "Channel is offline."
评论列表
文章目录