mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-16 20:11:01 +01:00
Fix ad condition parsing (#118)
* fix #117: use details slice and pre-set to properly extract condition * also added the type part of the detail content (original de: "Art") --------- Co-authored-by: Thomas von Dein <tom@vondein.org>
This commit is contained in:
7
ad.go
7
ad.go
@@ -31,7 +31,9 @@ type Ad struct {
|
||||
Title string `goquery:"h1"`
|
||||
Slug string
|
||||
ID string
|
||||
Condition string `goquery:".addetailslist--detail--value,text"`
|
||||
Details []string `goquery:".addetailslist--detail--value,text"`
|
||||
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"`
|
||||
@@ -56,6 +58,9 @@ func (ad *Ad) LogValue() slog.Value {
|
||||
)
|
||||
}
|
||||
|
||||
// static set of conditions available, used for post processing details
|
||||
var CONDITIONS = []string{"Neu", "Gut", "Sehr Gut", "In Ordnung"}
|
||||
|
||||
// check for completeness. I erected these fields to be mandatory
|
||||
// (though I really don't know if they really are). I consider images
|
||||
// and meta optional. So, if either of the checked fields here is
|
||||
|
||||
Reference in New Issue
Block a user