From 74f7deb6724b9f5b4be8d6d0ed6067523534968c Mon Sep 17 00:00:00 2001 From: Andreas Schulte Date: Wed, 25 Oct 2023 19:00:21 +0200 Subject: [PATCH] fixed html escaped characters --- imdb-scraper_test.go | 9 +++++++++ models.go | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/imdb-scraper_test.go b/imdb-scraper_test.go index 4c16046..fa4486c 100644 --- a/imdb-scraper_test.go +++ b/imdb-scraper_test.go @@ -217,6 +217,15 @@ func TestScrap(t *testing.T) { Type: "Series", 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 { diff --git a/models.go b/models.go index e56c8d6..e884ceb 100644 --- a/models.go +++ b/models.go @@ -1,6 +1,7 @@ package imdbs import ( + "html" "strings" "time" ) @@ -96,10 +97,10 @@ func (s IMDbJSON) TransformIntoIMDbEntry(id string, year int64) IMDbEntry { entry := IMDbEntry{ IMDbID: id, - AlternateName: s.AlternateName, + AlternateName: html.UnescapeString(s.AlternateName), Rating: s.AggregateRating.RatingValue, RuntimeInMins: 0, - Title: s.Name, + Title: html.UnescapeString(s.Name), Type: strings.Replace(s.Type, "TVSeries", "Series", -1), Year: year, }