updated tmdb

This commit is contained in:
2026-01-13 19:11:17 +11:00
parent 7c91cbb08a
commit 1a099a3724
10 changed files with 691 additions and 44 deletions

View File

@@ -2,7 +2,7 @@ package tmdb
import (
"encoding/json"
"fmt"
"strconv"
"github.com/pkg/errors"
)
@@ -42,11 +42,12 @@ type Crew struct {
Job string `json:"job"`
}
func GetCredits(movieid int32, token string) (*Credits, error) {
url := fmt.Sprintf("https://api.themoviedb.org/3/movie/%v/credits?language=en-US", movieid)
data, err := tmdbGet(url, token)
func (api *API) GetCredits(movieid int64) (*Credits, error) {
path := []string{"movie", strconv.FormatInt(movieid, 10), "credits"}
url := buildURL(path, nil)
data, err := api.get(url)
if err != nil {
return nil, errors.Wrap(err, "tmdbGet")
return nil, errors.Wrap(err, "api.get")
}
credits := Credits{}
json.Unmarshal(data, &credits)