Skip to content

Commit

Permalink
HTML parsing: adjust fallback heuristic (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
adbar authored Aug 11, 2023
1 parent ac71ad0 commit 2d61e21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion htmldate/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def load_html(htmlobject: Union[bytes, str, HtmlElement]) -> Optional[HtmlElemen
except Exception as err: # pragma: no cover
LOGGER.error("lxml parsing failed: %s", err)
# second pass: try passing bytes to LXML
if (tree is None or len(tree) < 2) and fallback_parse is False:
if (tree is None or len(tree) < 1) and not fallback_parse:
tree = fromstring_bytes(htmlobject)
# rejection test: is it (well-formed) HTML at all?
# log parsing errors
Expand Down

0 comments on commit 2d61e21

Please sign in to comment.