diff --git a/ad.go b/ad.go index dc463f9..22ccdc0 100644 --- a/ad.go +++ b/ad.go @@ -32,7 +32,8 @@ type Ad struct { Slug string ID string Details []string `goquery:".addetailslist--detail--value,text"` - Condition string // post processed + Condition string // post processed from details + Type string // post processed from details Category string CategoryTree []string `goquery:".breadcrump-link,text"` Price string `goquery:"h2#viewad-price"` diff --git a/config.go b/config.go index 91a3a24..6f1bae9 100644 --- a/config.go +++ b/config.go @@ -40,11 +40,11 @@ const ( Defaultdir string = "." DefaultTemplate string = "Title: {{.Title}}\nPrice: {{.Price}}\nId: {{.ID}}\n" + - "Category: {{.Category}}\nCondition: {{.Condition}}\n" + + "Category: {{.Category}}\nCondition: {{.Condition}}\nType: {{.Type}}\n" + "Created: {{.Created}}\nExpire: {{.Expire}}\n\n{{.Text}}\n" DefaultTemplateWin string = "Title: {{.Title}}\r\nPrice: {{.Price}}\r\nId: {{.ID}}\r\n" + - "Category: {{.Category}}\r\nCondition: {{.Condition}}\r\n" + + "Category: {{.Category}}\r\nCondition: {{.Condition}}\r\nType: {{.Type}}\r\n" + "Created: {{.Created}}\r\nExpires: {{.Expire}}\r\n\r\n{{.Text}}\r\n" DefaultUserAgent string = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " + diff --git a/example.conf b/example.conf index 12ba22e..9b94fe2 100644 --- a/example.conf +++ b/example.conf @@ -23,6 +23,7 @@ outdir = "test" #Id: {{.Id}} #Category: {{.Category}} #Condition: {{.Condition}} +#Type: {{.Type}} #Created: {{.Created}} #{{.Text}} diff --git a/kleingebaeck.1 b/kleingebaeck.1 index 5cc6d1d..ab38d62 100644 --- a/kleingebaeck.1 +++ b/kleingebaeck.1 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "KLEINGEBAECK 1" -.TH KLEINGEBAECK 1 "2024-02-10" "1" "User Commands" +.TH KLEINGEBAECK 1 "2025-02-06" "1" "User Commands" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -174,7 +174,7 @@ well. We use \s-1TOML\s0 as our configuration language. See .PP Format is pretty simple: .PP -.Vb 11 +.Vb 12 \& user = 1010101 \& loglevel = verbose \& outdir = "test" @@ -185,6 +185,7 @@ Format is pretty simple: \& Id: {{.ID}} \& Category: {{.Category}} \& Condition: {{.Condition}} +\& Type: {{.Type}} \& Created: {{.Created}} \& \& {{.Text}} @@ -267,12 +268,13 @@ variables as the ad name template above. .PP This is the default template: .PP -.Vb 7 +.Vb 8 \& Title: {{.Title}} \& Price: {{.Price}} \& Id: {{.ID}} \& Category: {{.Category}} \& Condition: {{.Condition}} +\& Type: {{.Type}} \& Created: {{.Created}} \& Expire: {{.Expire}} \& diff --git a/kleingebaeck.go b/kleingebaeck.go index 65a9f0e..4fbf9fe 100644 --- a/kleingebaeck.go +++ b/kleingebaeck.go @@ -46,6 +46,7 @@ CONFIGURATION Id: {{.ID}} Category: {{.Category}} Condition: {{.Condition}} + Type: {{.Type}} Created: {{.Created}} {{.Text}} @@ -111,6 +112,7 @@ TEMPLATES Id: {{.ID}} Category: {{.Category}} Condition: {{.Condition}} + Type: {{.Type}} Created: {{.Created}} Expire: {{.Expire}} diff --git a/kleingebaeck.pod b/kleingebaeck.pod index bff9e4d..522c84f 100644 --- a/kleingebaeck.pod +++ b/kleingebaeck.pod @@ -46,6 +46,7 @@ Format is pretty simple: Id: {{.ID}} Category: {{.Category}} Condition: {{.Condition}} + Type: {{.Type}} Created: {{.Created}} {{.Text}} @@ -131,6 +132,7 @@ This is the default template: Id: {{.ID}} Category: {{.Category}} Condition: {{.Condition}} + Type: {{.Type}} Created: {{.Created}} Expire: {{.Expire}} diff --git a/scrape.go b/scrape.go index ebc8123..6289067 100644 --- a/scrape.go +++ b/scrape.go @@ -128,7 +128,8 @@ func ScrapeAd(fetch *Fetcher, uri string) error { for _, detail := range advertisement.Details { if slices.Contains(CONDITIONS, detail) { advertisement.Condition = detail - break + } else { + advertisement.Type = detail } }