scraper

package
v0.0.0-...-bce67ef Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DostowWriter

func DostowWriter(apiURL, apiKey, storeName, category string, res chan map[string]interface{})

DostowWriter stores results in a store

func ScrapeCategory

func ScrapeCategory(url, category string, pages int) (chan map[string]interface{}, error)

ScrapeCategory scrapes a jumia category

func StreamItemResultsToIO

func StreamItemResultsToIO(ws io.Writer, res chan map[string]interface{})

StreamItemResultsToIO takes a scraper response and sends it to a jsonlines `io.writer`

Types

type Item

type Item struct {
	Brand string
	Image string
	Name  string
	Sku   string
	Link  string
}

Our structure which will be pushed to our stream

func (*Item) IsNil

func (u *Item) IsNil() bool

func (*Item) MarshalJSONObject

func (u *Item) MarshalJSONObject(enc *gojay.Encoder)

type Result

type Result struct {
	Data []map[string]interface{}
}

type SearchQuery

type SearchQuery struct {
	Name string `json:"name,omitempty"`
	Sku  string `json:"sku"`
}

type StreamChan

type StreamChan chan *Item

Our MarshalerStream implementation

func (StreamChan) MarshalStream

func (s StreamChan) MarshalStream(enc *gojay.StreamEncoder)

Jump to

Keyboard shortcuts

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