A Microdata parser in Go
Go to file
Роман Бородин a92a1fd3a1 имя модуля 2024-05-15 16:37:47 +03:00
.github/workflows Updated github workflows 2024-03-14 10:48:58 +00:00
AUTHORS Fixed breakage caused by h5 changes 2013-07-10 16:59:28 +01:00
CREDITS Fixed breakage caused by h5 changes 2013-07-10 16:59:28 +01:00
README.md Format examples and lint markdown 2018-09-14 13:45:02 +02:00
UNLICENSE Fixed breakage caused by h5 changes 2013-07-10 16:59:28 +01:00
WAIVER Fixed breakage caused by h5 changes 2013-07-10 16:59:28 +01:00
go.mod имя модуля 2024-05-15 16:37:47 +03:00
go.sum Update package dependencies + tidy (#44) 2024-05-08 09:08:55 +01:00
microdata.go дополнительные варианты поиска контента 2024-05-15 16:35:31 +03:00
microdata_test.go ensure itemscope always starts a new item 2020-10-11 12:30:55 -04:00



A microdata parser in Go

See http://www.w3.org/TR/microdata/ for more information about Microdata

Build Status


Simply run

go get github.com/iand/microdata

Documentation is at http://godoc.org/github.com/iand/microdata


Example of parsing a string containing HTML:

package main

import (

func main() {
    html := `<div itemscope>
        <p>My name is <span itemprop="name">Elizabeth</span>.</p>

    baseUrl, _ := url.Parse("http://example.com/")
    p := microdata.NewParser(strings.NewReader(html), baseUrl)

    data, err := p.Parse()
    if err != nil {

    println("Name: ", data.Items[0].Properties["name"][0].(string))

Extract microdata from a webpage and print the result as JSON

package main

import (


func main() {

    baseUrl, _ := url.Parse("http://www.designhive.com/blog/using-schemaorg-microdata")

    resp, _ := http.Get(baseUrl.String())
    defer resp.Body.Close()

    html, _ := ioutil.ReadAll(resp.Body)

    p := microdata.NewParser(bytes.NewReader(html), baseUrl)

    data, _ := p.Parse()

    json, _ := data.JSON()




  • Do submit your changes as a pull request
  • Do your best to adhere to the existing coding conventions and idioms.
  • Do run go fmt on the code before committing
  • Do feel free to add yourself to the CREDITS file and the corresponding Contributors list in the README.md. Alphabetical order applies.
  • Don't touch the AUTHORS file. An existing author will add you if your contributions are significant enough.
  • Do note that in order for any non-trivial changes to be merged (as a rule of thumb, additions larger than about 15 lines of code), an explicit Public Domain Dedication needs to be on record from you. Please include a copy of the statement found in the WAIVER file with your pull request


This is free and unencumbered software released into the public domain. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.