_find_encoding takes bytes
and soupifies now
This commit is contained in:
parent
c898bc4be1
commit
8e9da0d681
1 changed files with 2 additions and 1 deletions
|
@ -136,7 +136,8 @@ def _meta_content(s: str) -> typing.Dict[str, str]:
|
||||||
out[key] = value
|
out[key] = value
|
||||||
return out
|
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:
|
if not soup.meta == None:
|
||||||
meta_charset = soup.meta.get("charset")
|
meta_charset = soup.meta.get("charset")
|
||||||
if not meta_charset == None:
|
if not meta_charset == None:
|
||||||
|
|
Loading…
Reference in a new issue