Documentation ¶
Overview ¶
Package carousell provides primitives for querying Carousell (Singapore) and parsing the listings programatically.
It also provides a simple caching mechanism for users to store state on the listings, for example, only caching after post-processing of a listing is completed successfully.
Index ¶
Constants ¶
const ENDPOINT = "https://www.carousell.sg"
Variables ¶
This section is empty.
Functions ¶
func ShortenListings ¶
ShortenListings return a summarized output of a list of listings.
func WithPriceCeil ¶
func WithPriceFloor ¶
WithPriceFloor adds a filter for price floor.
func WithRecent ¶
func WithRecent(r *Req)
WithRecent ensures that only latest listings are being queried.
func WithSearch ¶
WithSearch adds a search term to a carousell Request.
Types ¶
type Cache ¶
A Cache is a structure that includes utilities, to store state on carousell listings after post-processing.
func (*Cache) ProcessAndStore ¶
Process accepts a callback that processes a new listing, before storing it in the cache
type Listing ¶
type Listing struct { Title string Description string Price float64 Condition string Url string User string Time string ID string }
A Listing is a single carousell post. It contains all the information extracted off a carousell listing.
type Req ¶
type Req struct {
// contains filtered or unexported fields
}
A Req is a structure that consists of relevant parameters to encapsulate a carousell GET request
func NewReq ¶
Creates a new carousell blank Request. Modifiers, e.g. WithSearch, are used to add search criteria, before sending out the Request via Get.