_find_encoding takes bytes and soupifies now

This commit is contained in:
jesopo 2019-11-26 13:58:37 +00:00
parent c898bc4be1
commit 8e9da0d681

View file

@ -136,7 +136,8 @@ def _meta_content(s: str) -> typing.Dict[str, str]:
out[key] = value
return out
def _find_encoding(soup: bs4.BeautifulSoup) -> typing.Optional[str]:
def _find_encoding(data: bytes) -> typing.Optional[str]:
soup = bs4.BeautifulSoup(data)
if not soup.meta == None:
meta_charset = soup.meta.get("charset")
if not meta_charset == None: