项目作者: gpahal

项目描述 :
A Go language library for parsing information in a HTML head tag
高级语言: Go
项目地址: git://github.com/gpahal/head.git
创建时间: 2020-06-16T09:51:15Z
项目社区:https://github.com/gpahal/head

开源协议:MIT License

下载


head

GoDoc

A go library for parsing information in a HTML head tag.

Installation

  1. go get github.com/gpahal/head

Usage

Processing a URL

The head.ProcessURL function takes a url string and a *http.Client, makes a
GET request to the url using the http client and returns a new *head.Object
from the returned HTML. If client is nil, a default client is used.

  1. object, err := head.ProcessURL("http://ogp.me", nil)

Parsing HTML

The head.ParseHTML function takes an io.Reader, reads HTML, parses the HTML
and returns a new *head.Object.

  1. resp, _ := http.Get("http://ogp.me")
  2. // ignoring the error and other response attributes (like status code)
  3. // for simplicity
  4. defer resp.Body.Close()
  5. object, err := head.ParseHTML(resp.Body)

Documentation

The complete API documentation is available on
GoDoc.

License

Licensed under MIT license (LICENSE or opensource.org/licenses/MIT)