walla

package
v0.0.0-...-d27f9a5 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0"
	URL        = "https://es.wallapop.com"
	URLAPIV3   = "https://api.wallapop.com/api/v3"
)

Variables

View Source
var (
	ErrFeedNotFound = errors.New("feed not found")
)
View Source
var KEY = []byte("Tm93IHRoYXQgeW91J3ZlIGZvdW5kIHRoaXMsIGFyZSB5b3UgcmVhZHkgdG8gam9pbiB1cz8gam9ic0B3YWxsYXBvcC5jb20==")

Functions

func Get

func Get(url string, params interface{}, res interface{}) (*http.Response, error)

func GetParamsString

func GetParamsString(url string, params string, res interface{}) (*http.Response, error)

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(fetchFn func(key string) (interface{}, error), expiration time.Duration) *Cache

func (*Cache) Clean

func (c *Cache) Clean()

func (*Cache) Get

func (c *Cache) Get(key string) (interface{}, error)

type CacheEntry

type CacheEntry struct {
	Timestamp time.Time
	Value     interface{}
}

type Feeds

type Feeds struct {
	// contains filtered or unexported fields
}

func NewFeeds

func NewFeeds(queries *Queries, cfg FeedsConfig) *Feeds

func (*Feeds) Get

func (f *Feeds) Get(name string) (*feeds.Feed, error)

func (*Feeds) Update

func (f *Feeds) Update()

type FeedsConfig

type FeedsConfig struct {
	CacheTimeout     time.Duration
	UpdateQueryDelay time.Duration
}

type Flags

type Flags struct {
	Pending  bool `json:"pending"`
	Sold     bool `json:"sold"`
	Reserved bool `json:"reserved"`
	Banned   bool `json:"banned"`
	Expired  bool `json:"expired"`
	OnHold   bool `json:"onhold"`
}

type Image

type Image struct {
	Original string `json:"original"`
}

type ItemImage

type ItemImage struct {
	URLs struct {
		Big string `json:"big"`
	} `json:"urls"`
}

type NextPage

type NextPage struct {
	Raw            string
	Step           int
	SearchID       string
	PaginationDate time.Time
}

func NewNextPage

func NewNextPage(raw string) (*NextPage, error)

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func NewQueries

func NewQueries(path string) (*Queries, error)

func (*Queries) Get

func (q *Queries) Get() map[string]Query

func (*Queries) Load

func (q *Queries) Load() error

type Query

type Query struct {
	Keywords       []string `toml:"keywords"`
	Ignores        []string `toml:"ignores"`
	LocationName   string   `toml:"location_name"`
	LocationRadius int      `toml:"location_radius"`
	MinPrice       int      `toml:"min_price"`
	MaxPrice       int      `toml:"max_price"`
}

type ReqMapsHerePlace

type ReqMapsHerePlace struct {
	PlaceID string `url:"placeId"`
}

type ReqSearch

type ReqSearch struct {
	Distance      float32 `url:"distance"`
	Keywords      string  `url:"keywords"`
	FiltersSource string  `url:"filters_source"`
	OrderBy       string  `url:"order_by"`
	MinSalePrice  int     `url:"min_sale_price"`
	MaxSalePrice  int     `url:"max_sale_price"`
	Latitude      float32 `url:"latitude"`
	Longitude     float32 `url:"longitude"`
	Language      string  `url:"language"`
}

type ResItem

type ResItem struct {
	ID           string      `json:"id"`
	ModifiedDate int64       `json:"modified_date"`
	Images       []ItemImage `json:"images"`
}

func GetItem

func GetItem(itemID string) (*ResItem, error)

type ResMapsHerePlace

type ResMapsHerePlace struct {
	Latitude  float32 `json:"latitude"`
	Longitude float32 `json:"longitude"`
}

func GetLocation

func GetLocation(place string) (*ResMapsHerePlace, error)

type ResSearch

type ResSearch struct {
	SearchObjects []SearchObject `json:"search_objects"`
}
func Search(opts SearchOpts, req *ReqSearch) (*ResSearch, error)

type SearchObject

type SearchObject struct {
	ID          string  `json:"id"`
	Title       string  `json:"title"`
	Description string  `json:"description"`
	Distance    float32 `json:"distance"`
	Images      []Image `json:"images"`
	User        User    `json:"user"`
	Flags       Flags   `json:"flags"`
	Price       float32 `json:"price"`
	Currency    string  `json:"currency"`
	WebSlug     string  `json:"web_slug"`
}

type SearchOpts

type SearchOpts struct {
	Age time.Duration
}

type User

type User struct {
	ID        string `json:"id"`
	MicroName string `json:"micro_name"`
	Image     Image  `json:"images"`
}

Jump to

Keyboard shortcuts

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