Handle parsing errors
This commit is contained in:
parent
422b0d5880
commit
56947296b5
|
@ -4,6 +4,7 @@ from urllib.parse import urljoin
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
from bs4.builder import ParserRejectedMarkup
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.style import StyleType
|
from rich.style import StyleType
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
|
@ -66,6 +67,9 @@ def standard_urlmap_exception_suppressor(exc: Exception, url: httpx.URL) -> bool
|
||||||
print_exc("Got ", (exc.__class__.__qualname__, "red"), ", (", (str(exc), "orange"), ")")
|
print_exc("Got ", (exc.__class__.__qualname__, "red"), ", (", (str(exc), "orange"), ")")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if isinstance(exc, ParserRejectedMarkup):
|
||||||
|
print_exc("Parsing failure: ", ("Invalid HTML", "red"))
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue