Независимо от того, просматриваете ли вы веб-страницы или нет, вы должны рассматривать JSON как JSON. Попытка интерпретировать JSON как текст с помощью RegEx всегда приведет к ошибке.
Вот пример получения нужной части JSON.
const jsonLdElement = document.querySelector("[type='application/ld+json']")
const jsonLd = JSON.parse(jsonLdElement.textContent)
console.log(jsonLd.uploadFinish)
console.log(jsonLd)
<script type="application/ld+json">
{
"@context": "http:\/\/schema.org",
"@type": "ImageObject",
"caption": "011 de 366\nMagali \ud83c\udf49 \n#magali #TurmadaMonica #illustration #ilustra\u00e7\u00e3o #art #drawing.",
"representativeOfPage": "http:\/\/schema.org\/True",
"uploadFinish": "2020-01-11T22:08:58",
"author": {
"@type": "Person",
"alternateName": "@luis",
"mainEntityofPage": {
"@type": "ProfilePage",
"@id": "https:\/\/www.example.com\/luis\/"
}
},
"comment": [{
"@type": "Comment",
"text": "\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e\ud83d\udc9e",
"author": {
"@type": "Person",
"alternateName": "@katiagualtieri985",
"mainEntityofPage": {
"@type": "ProfilePage",
"@id": "https:\/\/www.example.com\/katiagualtieri985\/"
}
}
}],
"commentCount": "1",
"contentLocation": {
"@type": "Place",
"name": "Florian\u00f3polis, Santa Catarina",
"mainEntityofPage": {
"@type": "CollectionPage",
"@id": "https:\/\/www.example.com\/explore\/locations\/213145014\/A-B-C-D\/"
},
"address": {
"@type": "PostalAddress",
"addressLocality": "Florian\u00f3polis, Santa Catarina",
"addressCountry": {
"@type": "Country",
"name": "BR"
}
}
},
"interactionStatistic": {
"@type": "InteractionCounter",
"interactionType": {
"@type": "LikeAction"
},
"userInteractionCount": "225"
},
"mainEntityofPage": {
"@type": "ItemPage",
"@id": "https:\/\/www.example.com\/p\/XDFASDFSAD\/"
},
"description": "225 Me gusta, 1 comentarios - Lu\u00eds (@luasdf) en Example: "011 de 366\nMagali \ud83c\udf49 \n#magali #TurmadaMonica #illustration #ilustra\u00e7\u00e3o #art #drawing."",
"name": "Lu\u00eds en example: \u201c011 de 366\nMagali \ud83c\udf49 \n#magali #TurmadaMonica #illustration #ilustra\u00e7\u00e3o #art #drawing.\u201d"
}
</script>