From 17c4e19bc5cff2ea4dbc59eb28399ad077c7eec4 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Thu, 16 Nov 2023 04:27:57 +0200 Subject: [PATCH] Filter XMLParsedAsHTMLWarnings * Parsing xhtml sites would trigger it. Signed-off-by: Alfred Wingate --- src/euscan/handlers/generic.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/euscan/handlers/generic.py b/src/euscan/handlers/generic.py index 9d3910a..62304ec 100644 --- a/src/euscan/handlers/generic.py +++ b/src/euscan/handlers/generic.py @@ -8,14 +8,11 @@ import re import urllib.error import urllib.parse import urllib.request +import warnings from urllib.parse import urljoin, urlparse -try: - from BeautifulSoup import BeautifulSoup -except ImportError: - from bs4 import BeautifulSoup - import portage +from bs4 import BeautifulSoup, XMLParsedAsHTMLWarning from euscan import ( BRUTEFORCE_BLACKLIST_PACKAGES, @@ -65,6 +62,7 @@ def confidence_score(found, original, minimum=CONFIDENCE): def scan_html(data, url, pattern): + warnings.filterwarnings("ignore", category=XMLParsedAsHTMLWarning) soup = BeautifulSoup(data, features="lxml") results = []