From 8e9da0d68148a64917c681606961e7ebede76393 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 26 Nov 2019 13:58:37 +0000 Subject: [PATCH] _find_encoding takes `bytes` and soupifies now --- src/utils/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/http.py b/src/utils/http.py index 8afc3e7e..b21d6e70 100644 --- a/src/utils/http.py +++ b/src/utils/http.py @@ -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: