mirror of
https://github.com/C5H12O5/syno-videoinfo-plugin.git
synced 2025-08-16 17:12:14 +00:00
Parse json string in non-strict mode
This commit is contained in:
@ -83,8 +83,8 @@ def _start(flow: "ScrapeFlow", limit: int):
|
||||
_results.append(next(result_gen))
|
||||
except StopIteration:
|
||||
break
|
||||
except ScrapeError as e:
|
||||
_logger.error("Error while scraping: %s", e)
|
||||
except ScrapeError:
|
||||
_logger.error("Failed to scrape from %s", flow.site, exc_info=True)
|
||||
|
||||
|
||||
class ScrapeFlow:
|
||||
|
@ -33,7 +33,7 @@ def str_to_etree(string: str) -> Optional[ElementTree.Element]:
|
||||
"""Convert a string to an ElementTree."""
|
||||
string = string.strip()
|
||||
if string.startswith("{") or string.startswith("["):
|
||||
return json_to_etree(json.loads(string))
|
||||
return json_to_etree(json.loads(string, strict=False))
|
||||
elif string.startswith("<"):
|
||||
return html_to_etree(string)
|
||||
return None
|
||||
|
Reference in New Issue
Block a user