Ask coding questions

← Back to all posts
Discord bot repeats itself and spams HTML code when asking for HTTP request
jort57 (25)

So I am making a discord bot with a command to do HTTP requests via beautifulsoup. Right now it's supposed to get the first <h1> tag and prints it in bold, and it will then get the first <p> tag and print it as well. In the code, I ask for it to get the text of the tags specifically. But when I ask it to get the text from wikipedia, it repeats itself, prints out HTML code, and just goes nuts.

I tried the exact same code by just printing it to a terminal and it works perfectly fine.

I have no idea what's happening here.