Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotComplete = errors.New("Not complete")
ErrNotComplete will be returned if the Scrape was not completley done
Logger instance for the entire module
Functions ¶
Types ¶
type ImageLocation ¶
type ImageLocation string
type SearchResult ¶
SearchResult represents the scrape result
func Scrape ¶
Scrape the given url
Example ¶
package main import ( "fmt" "net/http" "net/url" heroscrape "github.com/v-braun/hero-scrape" ) func main() { pageUrl, _ := url.Parse("https://github.com/v-braun/hero-scrape") res, _ := http.Get(pageUrl.String()) defer res.Body.Close() result, _ := heroscrape.Scrape(pageUrl, res.Body) fmt.Println(result.Image) }
Output:
func ScrapeWithStrategy ¶
func ScrapeWithStrategy(srcURL *url.URL, html io.Reader, strategies ...Strategy) (*SearchResult, error)
ScrapeWithStrategy scrapes the given url with the given strategy
func (*SearchResult) Complete ¶
func (sr *SearchResult) Complete() bool
Complete returns true if the SearchResult has found everything
type Strategy ¶
Strategy interface represents an interface for scraping an website
func NewHeuristicStrategy ¶
func NewHeuristicStrategy() Strategy
func NewOgStrategy ¶
func NewOgStrategy() Strategy
NewOgStrategy returns a new Strategy that search for OG meta tags
Click to show internal directories.
Click to hide internal directories.