Extract JSON-ld data

My aim is to extract structured data from webpages.

I’m able to extract the HTML5 Microdata (Schema.org) from webpages with microdata iand library in go. But, I can’t extract the JSON-LD format present in the webpages. Didn’t find any further documentations on it.

Can you link to an example web page that contains JSON-LD?

Which Go library do you use to extract HTML5 Microdata? Is this library capabale to extract JSON-LD?

Hi lutzhorn

link for JSON-LD data

I cant find any any library for JSON-ld.For microdata library in golang is IAND microdata

Getting JSON-ld ouput from URL:

“json-ld”: [
{
@context”: “http://schema.org”,
@type”: “Event”,
“description”: “<p>Juror\'s Lecture: November 10, in Carpenter Hall, from 4 to 5 PM, followed by a reception in the gallery from 5 to 7 […]</p>\n”,
“endDate”: “2018-12-23T23:59:59-08:00”,
“image”: “https://d11pj51h4ledry.cloudfront.net/wp-content/uploads/2018/07/20182348/2018-IJE-LOGO3-1-e1532136291438.jpg”,
“location”: {
@type”: “Place”,
“address”: {
@type”: “PostalAddress”,
“addressCountry”: “United States”,
“addressLocality”: “Carmel”,
“addressRegion”: “CA”,
“postalCode”: “93921”,
“streetAddress”: “San Carlos and 9th”
},
“description”: “”,
“geo”: {
@type”: “GeoCoordinates”,
“latitude”: 36.5513147,
“longitude”: -121.9218091
},
“name”: “Center for Photographic Art”,
“sameAs”:
“telephone”: “831 625-5181”,
“url”:
},
“name”: “2018 International Juried Exhibition <br>”,
“organizer”: {
@type”: “Person”,
“description”: “”,
“email”:
“name”: “CPA”,
“sameAs”:
“telephone”: “831 625-5181”,
“url”:
},
“startDate”: “2018-11-10T00:00:00-08:00”,
“url”:
}
]

This JSON is contained in <script> element reachable using this CSS selector:

head > script:nth-child(128)

It seems to be loaded by some JavaScript code. This means that it is not directly contained in the HTML. Making a HTTP GET for the URL will not give you a file that contains this data. So you will first have to find out which other HTTP request returns this JSON.

After this problem is solved, we can look for a library to parse the JSON-LD. Maybe this project can help:

Hi lutzhorn,

Thanks for sharing.I will try this thing if any other solution let me know.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.