mustafabayar / immo_trakt

Telegram Bot to find offers on immobilienscout24.de for given criterias.
MIT License
25 stars 7 forks source link

Failure Parsing json #6

Closed a0n closed 2 years ago

a0n commented 2 years ago
 2022/03/24 20:24:37 json: cannot unmarshal object into Go struct field .searchResponseModel.resultlist.resultlist.resultlistEntries.resultlistEntry of type []struct { ID string "json:\"@id\""; Publishdate string "json:\"@publishDate\""; ResultlistRealEstate struct { ID string "json:\"@id\""; Title string "json:\"title\""; Price struct { Value float32 "json:\"value\""; Currency string "json:\"currency\"" } "json:\"price\""; LivingSpace float32 "json:\"livingSpace\""; NumberOfRooms float32 "json:\"numberOfRooms\""; CalculatedTotalRent struct { Totalrent struct { Value float32 "json:\"value\""; Currency string "json:\"currency\"" } "json:\"totalRent\"" } "json:\"calculatedTotalRent\"" } "json:\"resultlist.realEstate\"" }
exit status 1

this stops the bot.

I will set up the boot to auto-restart for now. but would be cool to get to the bottom of why the JSON can't be parsed

fabihoe commented 2 years ago

I have the same problem. Initially, this error would occur after like 1 hour. Now it occurs right after restarting the program. Is it the same for you?

mustafabayar commented 2 years ago

Hey, sorry I totally missed open issues. I will try to find out the root cause of this problem. This never happened to me. But I have a suspicion. When I use this bot, I am using with drawn map view url which starts like "https://www.immobilienscout24.de/Suche/shape/wohnung-mieten?shape=", so maybe response format is not always same for diffferent type of searches. We can parse the response into map of interface to solve the issue maybe. If any of you have time feel free to open PR. I will also try to check it out when I have time.

mustafabayar commented 2 years ago

Will handle this in https://github.com/mustafabayar/immo_trakt/issues/7