From 614d11c6e8456d749164684128f36bcc03080bd6 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 3 Mar 2024 17:47:58 +0300 Subject: [PATCH] Fix(parse_html/bkmk_ph_beautifulsoup4): Find "shortcut icon" Bs4 splits attribute values. To fix it the value must be re-combined back. --- parse_html/bkmk_ph_beautifulsoup4.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parse_html/bkmk_ph_beautifulsoup4.py b/parse_html/bkmk_ph_beautifulsoup4.py index 7687c75..060f078 100644 --- a/parse_html/bkmk_ph_beautifulsoup4.py +++ b/parse_html/bkmk_ph_beautifulsoup4.py @@ -139,6 +139,7 @@ def _find_refresh(Tag): def _find_icon(Tag): - return (Tag.name == "link") and \ - (Tag.get_attribute_list("rel", '')[0].lower() - in ('icon', 'shortcut icon')) + if Tag.name != "link": + return False + rel = ' '.join(Tag.get_attribute_list("rel", '')) + return rel in ('icon', 'shortcut icon') -- 2.39.5