Answer the question
In order to leave comments, you need to log in
Beautiful design when parsing?
Good afternoon. There is a code.
@client.command()
async def online(ctx):
parse = "https://arizona-rp.com"
headers = {"User-Agent": "?)"}
page = requests.get(parse, headers = headers)
soup = BeautifulSoup(page.content, "html.parser")
serveronline = soup.find("div", "monitoring").text
embed = discord.Embed(description = 'Мониторинг игровых серверов Arizona', color = random.choice(colors))
embed.add_field(name = f"`Онлайн серверов`", value = serveronline, inline = False)
await ctx.send(embed = embed)
Answer the question
In order to leave comments, you need to log in
Try the strip() method:
serveronline = soup.find("div", "monitoring").text.strip()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question