def _online_tibia(self):
"""Get total players playing"""
url = "http://www.tibia.com/community/?subtopic=worlds"
try:
async with aiohttp.get(url) as response:
soup = BeautifulSoup(await response.text(), "html.parser")
div1 = soup.find('div', attrs={'id': 'RightArtwork'})
div2 = div1.find('div', attrs={'id': 'PlayersOnline'})
test = div2.get_text()
test1 = test.replace("Players Online", "")
new = "Players currently playing Tibia: " + test1
# div2 = div1.find('div', attrs={'class': 'Border_2'})
# div3 = div2.find('div', attrs={'class': 'Border_3'})
# table = div3.find_all('table', attrs={'class': 'Table1'})
# tr = table.find_all('tr')
# tbody = div4.find('div', attrs={'class': 'CaptionInnerContainer'})
await self.bot.say(str(new))
except:
await self.bot.say("Could not retrive data. The webserver may be offline.")
评论列表
文章目录