|
|
@ -70,6 +70,10 @@ def extract_json_as_string(content, jsonpath_filter):
|
|
|
|
raise JSONNotFound("No parsable JSON found in this document")
|
|
|
|
raise JSONNotFound("No parsable JSON found in this document")
|
|
|
|
|
|
|
|
|
|
|
|
for result in bs_result:
|
|
|
|
for result in bs_result:
|
|
|
|
|
|
|
|
# Skip empty tags, and things that dont even look like JSON
|
|
|
|
|
|
|
|
if not result.string or not '{' in result.string:
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
json_data = json.loads(result.string)
|
|
|
|
json_data = json.loads(result.string)
|
|
|
|
except json.JSONDecodeError:
|
|
|
|
except json.JSONDecodeError:
|
|
|
@ -80,4 +84,7 @@ def extract_json_as_string(content, jsonpath_filter):
|
|
|
|
if stripped_text_from_html:
|
|
|
|
if stripped_text_from_html:
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not stripped_text_from_html:
|
|
|
|
|
|
|
|
raise JSONNotFound("No JSON matching the rule '%s' found" % jsonpath_filter.replace('json:',''))
|
|
|
|
|
|
|
|
|
|
|
|
return stripped_text_from_html
|
|
|
|
return stripped_text_from_html
|
|
|
|