Поддержка The Movie Database

I am trying to receive crew data for this show but it's an empty array whilst the cast array has items.

"https://api.themoviedb.org/3/tv/4614?api_key={key}&append_to_response=images,credits" works but gives me empty crew data.

"https://api.themoviedb.org/3/tv/4614/credits?api_key={key}" also works but gives me empty crew data.

"https://api.themoviedb.org/3/tv/4614?api_key={key}&append_to_response=credits" gives me a 502 Bad Gateway.

Just been referred to here from the main website, but seeing there is a overhaul… not sure if it's necessary to notify anyone here.

Let me know if you need any additional information.

3 ответов (на странице 1 из 1)

Jump to last post

The default query for the API cast & crew is to look at the last season. As you can see here, season 17 of NCIS doesn't have any crew added.

The view you see here on the website is a bit different. It's aggregating the cast & crew for the whole series. This feature hasn't been implemented on the API yet. You can find the ticket tracking this here.

Shouldn't be hard to aggregate in my own database. I see that the 502 is fixed now.

Thanks for the info. If you need someone who's very picky let me know if you need a tester wink

I am going to leave this here for anyone using the Laravel framework.
Add this to your TV model.


public function getDirectorsAttribute()
{
    // Get all episodes with crew relation data.
    $tv = Episode::where('tv_id', $this->id)
        ->with('crew')
        ->get();

    // Loop trough every episode.
    $crew = [];
    foreach($tv as $episode){
        foreach($episode->crew as $item){ 
            // Filter on Directors.
            if ($item->job == 'Director') {
                $crew[] = $item->name;
            }
        }
    }
    // sort directors by amount of episodes directed and order them from high to low.
    $count = array_count_values($crew);
    arsort($count);

     // Take only directors with a minimum of 10.
    $directors = [];
    foreach($count as $item => $amount){
        if($amount > 10){
            $directors[] = $item;
        }
    }
    // Implode directors to single line comma separated and add a space after comma.
    return str_replace(',', ', ', implode(",", $directors));
}    

Не можете найти фильм или сериал? Войдите на сайт, чтобы добавить его.

Глобальные

s фокусироваться на панели поиска
p открыть меню профиля
esc закрыть открытое окно
? открыть окно сочетаний клавиш

На страницах медиа

b назад (или выше, если применимо)
e перейти на страницу правки

На страницах сезонов

(стрелка вправо) перейти к следующему сезону
(стрелка влево) перейти к предыдущему сезону

На страницах эпизодов

(стрелка вправо) перейти к следующему эпизоду
(стрелка влево) перейти к предыдущему эпизоду

На всех страницах изображений

a открыть окно добавления изображения

На всех страницах правки

t открыть переключатель переводов
ctrl+ s отправить форму

На страницах обсуждения

n создать новое обсуждение
w сменить статус отслеживания
p публичное/приватное
c закрыть/открыть
a открыть страницу действий
r ответить в обсуждении
l перейти к последнему ответу
ctrl+ enter отправить своё сообщение
(стрелка вправо) следующая страница
(стрелка влево) предыдущая страница

Параметры

Хотите поставить оценку или добавить в список?

Войти