[common] support single quotes in '_extract_jsonld' & '…_nextdata'
This commit is contained in:
@@ -666,12 +666,18 @@ class Extractor():
|
||||
return False
|
||||
|
||||
def _extract_jsonld(self, page):
|
||||
return util.json_loads(text.extr(
|
||||
page, '<script type="application/ld+json">', "</script>"))
|
||||
return util.json_loads(
|
||||
text.extr(page, '<script type="application/ld+json">',
|
||||
"</script>") or
|
||||
text.extr(page, "<script type='application/ld+json'>",
|
||||
"</script>"))
|
||||
|
||||
def _extract_nextdata(self, page):
|
||||
return util.json_loads(text.extr(
|
||||
page, ' id="__NEXT_DATA__" type="application/json">', "</script>"))
|
||||
return util.json_loads(
|
||||
text.extr(page, ' id="__NEXT_DATA__" type="application/json">',
|
||||
"</script>") or
|
||||
text.extr(page, " id='__NEXT_DATA__' type='application/json'>",
|
||||
"</script>"))
|
||||
|
||||
def _cache(self, func, maxage, keyarg=None):
|
||||
# return cache.DatabaseCacheDecorator(func, maxage, keyarg)
|
||||
|
||||
Reference in New Issue
Block a user