import requests from bs4 import BeautifulSoup def check_li_tags(url): try: # Fetch the webpage content response = requests.get(url) response.raise_for_status() # Raise error for bad responses (4xx, 5xx) # Parse HTML content soup = BeautifulSoup(response.text, "lxml") # Find all
  • elements li_elements = soup.find_all("li") print(f"Found {len(li_elements)}
  • elements. Checking for missing tags...\n") # Iterate through
  • elements for index, li in enumerate(li_elements): if not li.find("a"): print(f"🚨 Missing tag in
  • at index {index}:") print(li.prettify()) # Prints the full
  • element in a readable format print("-" * 50) # Separator for readability except requests.exceptions.RequestException as e: print(f"Error fetching the URL: {e}") # Prompt user for a URL url = input("Enter the URL to check: ").strip() check_li_tags(url)