X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=parse_html%2Fbkmk_ph_beautifulsoup4.py;h=060f0786d473c17de36ad073c05632c06f30c35d;hb=a9f7112dec88b4136ad5ef7c6876e5c9ef14745c;hp=faafca22eb3ee276b70eddf161c4ae8f30a5327f;hpb=3dcc828780e34c685703def5278607cfd283fb72;p=bookmarks_db.git diff --git a/parse_html/bkmk_ph_beautifulsoup4.py b/parse_html/bkmk_ph_beautifulsoup4.py index faafca2..060f078 100644 --- a/parse_html/bkmk_ph_beautifulsoup4.py +++ b/parse_html/bkmk_ph_beautifulsoup4.py @@ -69,9 +69,12 @@ def parse_html(html_text, charset=None, log=None): else: parts = [] for part in title: - if not isinstance(part, string_type): - part = part.decode() - parts.append(part.strip()) + #if not isinstance(part, string_type): + # part = part.decode() + if part.strip: + parts.append(part.strip()) + else: + parts.append(' ') # Skip tags, they're usually `
` title = ''.join(parts) meta = head.find(_find_contenttype, recursive=False) @@ -136,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')