Merge pull request #39 from iamsad5566/main

fix: fix null comments and prices
This commit is contained in:
Georgios Komninos
2024-04-18 19:54:13 +03:00
committed by GitHub
2 changed files with 16 additions and 11 deletions
+16 -11
View File
@@ -341,28 +341,33 @@ func EntryFromJSON(raw []byte) (entry Entry, err error) {
5: int(getNthElementAndCast[float64](darray, 175, 3, 4)),
}
reviewsI := getNthElementAndCast[[]any](darray, 52, 0)
reviewsI := getNthElementAndCast[[]any](darray, 175, 9, 0, 0)
for i := range reviewsI {
el := getNthElementAndCast[[]any](reviewsI, i)
el := getNthElementAndCast[[]any](reviewsI, i, 0)
price := getNthElementAndCast[any](el, 2, 6, 2, 2, 0, 0, 1)
if price != nil {
entry.PriceRange = price.(string)
}
time := getNthElementAndCast[[]any](el, 2, 2, 0, 1, 21, 6, 7)
review := Review{
Name: getNthElementAndCast[string](el, 0, 1),
ProfilePicture: getNthElementAndCast[string](el, 0, 2),
When: getNthElementAndCast[string](el, 1),
Rating: int(getNthElementAndCast[float64](el, 4)),
Description: getNthElementAndCast[string](el, 3),
Name: getNthElementAndCast[string](el, 1, 4, 0, 4),
ProfilePicture: getNthElementAndCast[string](el, 1, 4, 0, 3),
When: fmt.Sprintf("%v-%v-%v", time[0], time[1], time[2]),
Rating: int(getNthElementAndCast[float64](el, 2, 0, 0)),
Description: getNthElementAndCast[string](el, 2, 15, 0, 0),
}
if review.Name == "" {
continue
}
optsI := getNthElementAndCast[[]any](el, 14)
optsI := getNthElementAndCast[[]any](el, 2, 2, 0, 1, 21, 7)
for j := range optsI {
val := getNthElementAndCast[string](optsI, j, 6, 0)
val := getNthElementAndCast[string](optsI, j)
if val != "" {
review.Images = append(review.Images, val)
review.Images = append(review.Images, val[2:])
}
}
BIN
View File
Binary file not shown.