Take BS4 parser string from kwargs so you can actually XML. idk even what's the point
This commit is contained in:
parent
bc94c862c1
commit
6383a45d3a
1 changed files with 2 additions and 2 deletions
4
Utils.py
4
Utils.py
|
@ -72,9 +72,9 @@ def get_url(url, **kwargs):
|
||||||
response_content = response.read()
|
response_content = response.read()
|
||||||
encoding = response.info().get_content_charset()
|
encoding = response.info().get_content_charset()
|
||||||
if kwargs.get("soup"):
|
if kwargs.get("soup"):
|
||||||
return bs4.BeautifulSoup(response_content, "lxml")
|
return bs4.BeautifulSoup(response_content, kwargs.get("parser", "lxml"))
|
||||||
if not encoding:
|
if not encoding:
|
||||||
soup = bs4.BeautifulSoup(response_content, "lxml")
|
soup = bs4.BeautifulSoup(response_content, kwargs.get("parser", "lxml"))
|
||||||
metas = soup.find_all("meta")
|
metas = soup.find_all("meta")
|
||||||
for meta in metas:
|
for meta in metas:
|
||||||
if "charset=" in meta.get("content", ""):
|
if "charset=" in meta.get("content", ""):
|
||||||
|
|
Loading…
Reference in a new issue