Skip to content

Commit 3c0665e

Browse files
author
Harry
committed
fix: remove the regex of JS comment
1 parent c7a8759 commit 3c0665e

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

extruct/jsonld.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from extruct.utils import parse_html
1212

13-
HTML_OR_JS_COMMENTLINE = re.compile(r'^\s*(//.*|<!--.*-->)')
1413

1514

1615
class JsonLdExtractor(object):
@@ -34,8 +33,7 @@ def _extract_items(self, node):
3433
data = json.loads(script, strict=False)
3534
except ValueError:
3635
# sometimes JSON-decoding errors are due to leading HTML or JavaScript comments
37-
data = jstyleson.loads(
38-
HTML_OR_JS_COMMENTLINE.sub('', script), strict=False)
36+
data = jstyleson.loads(script, strict=False)
3937
if isinstance(data, list):
4038
return data
4139
elif isinstance(data, dict):

0 commit comments

Comments
 (0)