bugfix when downloading films

This commit is contained in:
gkiviv
2024-12-03 19:07:45 +02:00
parent 1ee53713b9
commit 5e9e6e6350

View File

@@ -2,6 +2,7 @@ package downloader
import ( import (
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"net/http" "net/http"
@@ -17,7 +18,7 @@ type ContentPageData struct {
type Data struct { type Data struct {
MainContent MainContent `json:"mainContent"` MainContent MainContent `json:"mainContent"`
SeasonList SeasonList `json:"seasonList"` SeasonList SeasonList `json:"seasonList"`
} }
type MainContent struct { type MainContent struct {
@@ -152,7 +153,12 @@ func GetContentPageData(contentId string) *ContentPageData {
err = json.Unmarshal(bytes, &data) err = json.Unmarshal(bytes, &data)
if err != nil { if err != nil {
panic(err) var unmarshalTypeError *json.UnmarshalTypeError
if errors.As(err, &unmarshalTypeError) {
data.Data.SeasonList = SeasonList{}
} else {
panic(err)
}
} }
return &data return &data