parsers

package
v0.0.0-...-251dd7d Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAttribute

func GetAttribute(token html.Token, attribute string) string

get content of an attribute given the tag returns empty array if attribute is not found

func IsUrl

func IsUrl(str string) bool

validate url

func NewHeadingsParser

func NewHeadingsParser() headingsParser

func NewHtmlVersionParser

func NewHtmlVersionParser() htmlVersionParser

func NewLinksParser

func NewLinksParser() linksParser

func NewLoginFormParser

func NewLoginFormParser() loginFormParser

func NewTitleParser

func NewTitleParser() titleParser

Types

type AnalysisResponse

type AnalysisResponse interface {
	// setting the page title.
	SetTitle(title string)

	// setting the page html version.
	SetHtmlVersion(version string)

	// setting if page has login or not.
	SetHasLogin(hasLogin bool)

	// add heading and its level
	AddHeading(heading string, content string)

	// add link
	AddLink(link Link)
}

func NewAnalysisResponse

func NewAnalysisResponse() AnalysisResponse

type AnalysisSuccessResponse

type AnalysisSuccessResponse struct {
	Title    string    `json:"title"`
	Version  string    `json:"htmlVersion"`
	HasLogin bool      `json:"hasLogin"`
	Headings []Heading `json:"headings"`
	Links    []Link    `json:"links"`
}

func (*AnalysisSuccessResponse) AddHeading

func (ap *AnalysisSuccessResponse) AddHeading(tag string, content string)
func (ap *AnalysisSuccessResponse) AddLink(link Link)

func (*AnalysisSuccessResponse) SetHasLogin

func (ap *AnalysisSuccessResponse) SetHasLogin(hasLogin bool)

func (*AnalysisSuccessResponse) SetHtmlVersion

func (ap *AnalysisSuccessResponse) SetHtmlVersion(version string)

func (*AnalysisSuccessResponse) SetTitle

func (ap *AnalysisSuccessResponse) SetTitle(title string)

type Heading

type Heading struct {
	TagName  string   `json:"tagName"`
	Contents []string `json:"contents"`
}
type Link struct {
	Url       string `json:"url"`
	LinkType  string `json:"linkType"`
	Reachable bool   `json:"reachable"`
}

Jump to

Keyboard shortcuts

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