scrapers

package
v0.0.0-...-79266e1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DirPerm = 0o755

DirPerm encodes new directory permissions.

Variables

This section is empty.

Functions

func MergeStreets

func MergeStreets(dir string, mID int64) ([]*pb.Settlement, error)

func SaveMunicipalities

func SaveMunicipalities(ms []*pb.Municipality, dir string) error

SaveMunicipalities stores municipality data in the expected directory layout.

func SaveSettlements

func SaveSettlements(ss []*pb.Settlement, dir string, mID int64) error

func Scrape4Captchas

func Scrape4Captchas(ctx context.Context, municipalities string, samples int) (chan *pb.Captcha, chan error)

Scrape5Captchas scrapes 4-digit captchas.

func Scrape5Captchas

func Scrape5Captchas(ctx context.Context, municipalities string, samples int) (chan *pb.Captcha, chan error)

Scrape5Captchas scrapes 5-digit captchas.

func ScrapeCaptchas

func ScrapeCaptchas(ctx context.Context, typ pb.Captcha_Type, municipalities string, samples int) (cs chan *pb.Captcha, errs chan error)

ScrapeCaptchas fetches captchas of any type. It will keep generating captchas until the context is cancelled.

func ScrapeMunicipalities

func ScrapeMunicipalities() ([]*pb.Municipality, error)

ScrapeMunicipalities fetches all municipality data.

func ScrapeStreets

func ScrapeStreets(dir string, mID int64) (chan *StreetSearchResults, chan error)

ScrapeStreets fetches streets for a single municipality.

Types

type ScalarMunicipality

type ScalarMunicipality struct {
	pb.Municipality

	CadastralMunicipalities []int64 `json:"cadastral_municipalities"`
}

ScalarMunicipality is a Municipality with only scalar fields. Non-scalar (i.e. message) fields are turned into references (i.e. IDs).

type StreetSearchResults

type StreetSearchResults struct {
	Query     string       `json:"query"`
	Results   []*pb.Street `json:"results"`
	UpdatedAt time.Time    `json:"updated_at"`
}

func (*StreetSearchResults) Save

func (sr *StreetSearchResults) Save(dir string, mID int64) error

Save saves the results to disk.

Jump to

Keyboard shortcuts

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