website

package module
v0.0.0-...-2b83bc9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2016 License: LGPL-3.0 Imports: 6 Imported by: 0

README

Build Status Code Climate GoDoc Built with Spacemacs

golibri/website

Get Metadata from HTML

Requirements

go get -u github.com/golibri/fetch

installation

go get -u github.com/golibri/website

usage

import "github.com/golibri/website"

func main() {
    ws := website.FromURL("http://example.com/whatever")
    // OR:
    ws := website.Parse("website-html-string")
    // ws is a Website object, see below
}

data fields

A Website has the following data fields:

type Website struct {
    URL         string
    Body        string
    Language    string
    Title       string
    Description string
    Image       string
    Favicon     string
    Feeds       []string
    Tags        []string
    }

license

LGPLv3. (You can use it in commercial projects as you like, but improvements/bugfixes must flow back to this lib.)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Website

type Website struct {
	URL         string
	Body        string
	Language    string
	Title       string
	Description string
	Image       string
	Favicon     string
	Feeds       []string
	Tags        []string
}

Website contains all relevant metadata from a HTML web page

func FromURL

func FromURL(URL string) (Website, error)

FromURL parses a Website directly from a given URL

func Parse

func Parse(s string) (Website, error)

Parse executes a given HTML string and transforms it into a Website{} struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL