fixed html escaped characters

This commit is contained in:
Andreas Schulte 2023-10-25 19:00:21 +02:00
parent 469e2984bc
commit 74f7deb672
Signed by: andreas
GPG Key ID: DCD1B6A247B69DB6
2 changed files with 12 additions and 2 deletions

View File

@ -217,6 +217,15 @@ func TestScrap(t *testing.T) {
Type: "Series", Type: "Series",
Year: 2019, Year: 2019,
}, },
"tt0366551": {
AlternateName: "Harold & Kumar",
IMDbID: "tt0366551",
Rating: 7.0,
RuntimeInMins: 88,
Title: "Harold & Kumar Go to White Castle",
Type: "Movie",
Year: 2004,
},
} }
for d, expectedResult := range data { for d, expectedResult := range data {

View File

@ -1,6 +1,7 @@
package imdbs package imdbs
import ( import (
"html"
"strings" "strings"
"time" "time"
) )
@ -96,10 +97,10 @@ func (s IMDbJSON) TransformIntoIMDbEntry(id string, year int64) IMDbEntry {
entry := IMDbEntry{ entry := IMDbEntry{
IMDbID: id, IMDbID: id,
AlternateName: s.AlternateName, AlternateName: html.UnescapeString(s.AlternateName),
Rating: s.AggregateRating.RatingValue, Rating: s.AggregateRating.RatingValue,
RuntimeInMins: 0, RuntimeInMins: 0,
Title: s.Name, Title: html.UnescapeString(s.Name),
Type: strings.Replace(s.Type, "TVSeries", "Series", -1), Type: strings.Replace(s.Type, "TVSeries", "Series", -1),
Year: year, Year: year,
} }