bugfix when downloading films
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user