goscraper

package module
v0.0.0-...-fb723c5 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2018 License: MIT Imports: 9 Imported by: 1

README

goscraper

Golang package to quickly return the webpage title

Usage

func main() {
	s, err := goscraper.Scrape("https://www.w3.org/", 5)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Printf("Title : %s\n", s.Preview.Title)
}

output:

Title : World Wide Web Consortium (W3C)

License

Goscraper is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EscapedFragment string = "_escaped_fragment_="
)

Functions

This section is empty.

Types

type Document

type Document struct {
	Body    bytes.Buffer
	Preview DocumentPreview
}

func Scrape

func Scrape(uri string, maxRedirect int) (*Document, error)

type DocumentPreview

type DocumentPreview struct {
	Title string
	Link  string
}

type Scraper

type Scraper struct {
	Url                *url.URL
	EscapedFragmentUrl *url.URL
	MaxRedirect        int
}

func (*Scraper) Scrape

func (scraper *Scraper) Scrape() (*Document, error)

Jump to

Keyboard shortcuts

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