def analytics(self, ctx, url):
"""Analytics for url"""
key = self.loadapi["ApiKey"]
async with aiohttp.ClientSession() as session:
async with session.get('https://www.googleapis.com/urlshortener/v1/url?key=' + key + '&shortUrl=' + url + '&projection=FULL') as resp:
print(resp.status)
yes = await resp.json()
embed = discord.Embed(colour=discord.Colour.blue())
embed.add_field(name="**Shortened Url:**",value=yes['id'])
embed.add_field(name="**Long Url:**",value=yes['longUrl'])
embed.add_field(name="**Date Created:**",value=yes['created'])
embed.add_field(name="**Clicks:**",value=yes['analytics']['allTime']['shortUrlClicks'])
embed.set_image(url="https://www.ostraining.com/cdn/images/coding/google-url-shortener-tool.jpg")
await self.bot.say(embed=embed)
评论列表
文章目录