fix #117: use details slice and pre-set to properly extract condition

This commit is contained in:
2025-02-06 10:29:24 +01:00
parent cd3d00adbe
commit 22da878f27
6 changed files with 25 additions and 9 deletions

6
ad.go
View File

@@ -31,7 +31,8 @@ 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
Category string
CategoryTree []string `goquery:".breadcrump-link,text"`
Price string `goquery:"h2#viewad-price"`
@@ -56,6 +57,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