fixed changes on kleinanzeigen.de:

- Meta did not contain condition and category together anymore, they
removed  the category. Therefore fetching (that is, validation)
failed.
- Now we extract the condition and category directly.
- On top, category now includes the whole category tree.
- unit tests had to be tweaked for this measure.
This commit is contained in:
2024-01-12 14:11:02 +01:00
parent 6b7f727449
commit 0fd9b519d1
3 changed files with 29 additions and 19 deletions

View File

@@ -135,12 +135,13 @@ func Scrape(c *Config, uri string) error {
if err != nil {
return err
}
if len(ad.Meta) == 2 {
ad.Category = ad.Meta[0]
ad.Condition = ad.Meta[1]
if len(ad.CategoryTree) > 0 {
ad.Category = strings.Join(ad.CategoryTree, " => ")
}
if ad.Incomplete() {
slog.Debug("got ad", "ad", ad)
return errors.New("could not extract ad data from page, got empty struct")
}