tame

package module
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: MIT Imports: 5 Imported by: 0

README

TAME

Build Status Go Report Card GoDoc

Simple HTTP wrapper to retrieve arbitrary web pages. Currently under development.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(d Document, targets ...interface{}) error

Unmarshal reads data from document to provided targets Read operation is performed sequentially, first error occured will cancel rest of process

Types

type ByteDocument

type ByteDocument []byte

ByteDocument is simple implementation on Document interface Also it is plain wrapper over byte slice

func (ByteDocument) GetBody

func (b ByteDocument) GetBody() []byte

GetBody returns body contents

func (ByteDocument) GetHeaders

func (ByteDocument) GetHeaders() http.Header

GetHeaders returns empty headers map

func (ByteDocument) GetURL

func (ByteDocument) GetURL() url.URL

GetURL returns empty URL

type DOMDocument

type DOMDocument interface {
	Document
	DOMSelection
}

DOMDocument is an extended version of document, that supports DOM operations

type DOMSelection

type DOMSelection interface {
	Size() int
	Find(query string) DOMSelection
	Attr(attr, defaultValue string) string

	Each(func(DOMSelection))

	ReadText(query string, target *string) error
	ReadAttr(query, attr string, target *string) error

	AsText() string
}

DOMSelection describes DOM node

type Document

type Document interface {
	GetURL() url.URL
	GetHeaders() http.Header
	GetBody() []byte
}

Document interface describes parseable entities (HTML pages in common)

Directories

Path Synopsis
app
cmd
recipes
dom
util

Jump to

Keyboard shortcuts

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