Take BS4 parser string from kwargs so you can actually XML. idk even what's the point

This commit is contained in:
Evelyn 2017-06-07 21:36:11 +01:00
parent bc94c862c1
commit 6383a45d3a

View file

@ -72,9 +72,9 @@ def get_url(url, **kwargs):
response_content = response.read()
encoding = response.info().get_content_charset()
if kwargs.get("soup"):
return bs4.BeautifulSoup(response_content, "lxml")
return bs4.BeautifulSoup(response_content, kwargs.get("parser", "lxml"))
if not encoding:
soup = bs4.BeautifulSoup(response_content, "lxml")
soup = bs4.BeautifulSoup(response_content, kwargs.get("parser", "lxml"))
metas = soup.find_all("meta")
for meta in metas:
if "charset=" in meta.get("content", ""):