import requests, bs4, html5lib
from bs4 import BeautifulSoup
url = "https://trouver-ip.com"
ip = input("Choisissez une IP : ")
response = requests.post(url, data={"ip": ip})
soup = BeautifulSoup(response.text, "html.parser")
print(response)
def compare():
if soup.find("tbody"):
tableau = soup.findAll("html")
return(tableau)
else:
print("Aucun résultat, foirage de code masturbin")
tableau = compare()
print(tableau)
Whatever what I put at the place of "html" in tag search. I tried many tag that I'm sure they are in the HTML content, but my code don't found anything. By the way, when I try I have my "else" message with the print.
CodePudding user response:
You can search for the table
instead of tbody
,
def compare():
tableau = soup.find("table"):
return tableau
else:
return "Aucun résultat, foirage de code masturbin"