دعم الموقع

How do I return the director, writer and limit to the first 10 cast members?

3 ردود (على هذه الصفحة 1 من 1)

Jump to last post

Hi @jerauf You can call the /credits method to get all of that information. I would also suggest taking a read through the 'append_to_response' documentation to learn how you can make that call in a single request.

Cheers.

Thanks for the response, Travis. What I don't understand about this is how it will allow me to manipulate the data that's returned. With 'append_to_reponse', you're only appending specific requests, not the data.

I'm not sure if I understand what you mean. By using 'append_to_response' the extra requests gets returned in the same single response you are making. It appends the data to a field with the same name as the appended requests. So in the example '/credits', now there is a credits field.

https://api.themoviedb.org/3/movie/550?api_key=###&append_to_response=credits
{  
   "adult":false,
   ... 
"credits":{  
      "cast":[  
         {  
            "cast_id":4,
            "character":"The Narrator",
            "credit_id":"52fe4250c3a36847f80149f3",
            "id":819,
            "name":"Edward Norton",
            "order":0,
            "profile_path":"/iUiePUAQKN4GY6jorH9m23cbVli.jpg"
         },
         {  
            "cast_id":5,
            "character":"Tyler Durden",
            "credit_id":"52fe4250c3a36847f80149f7",
            "id":287,
            "name":"Brad Pitt",
            "order":1,
            "profile_path":"/kc3M04QQAuZ9woUvH3Ju5T7ZqG5.jpg"
         },
         ...
      ],
      "crew":[  
         {  
            "credit_id":"56380f0cc3a3681b5c0200be",
            "department":"Writing",
            "id":7469,
            "job":"Screenplay",
            "name":"Jim Uhls",
            "profile_path":null
         },
         ...
      ]
   }
}

I've truncated the response here obviously, because it's too long but you can see here, the credits field gets added and becomes part of the response.

So with the credits returned back, just iterate over the array selecting the first 10 items from the cast array, and then iterate over the crew array grabbing whatever job(s) you want to display.

لم تجد الفلم أو المسلسل ؟ سجل دخولك و انشئها

عام

s ركز شريط البحث
p افتح قائمة الملف الشخصي
esc اغلق النافذة المفتوحة
? افتح نافذة اختصارات لوحة المفاتيح

على كافة صفحات الوسائط

b ارجع للخلف (او للصفحة الام عند التطبيق)
e انتقل لصفحة التعديل

على كافة صفحات موسم المسلسل

(السهم الايمن) انتقل للموسم التالي
(السهم الايسر) انتقل للموسم السابق

على كافة صفحات حلقة المسلسل

(السهم الايمن) انتقل للحلقة التالية
(السهم الايسر) انتقل للحلقة السابقة

على كافة صفحات الصور

a افتح صفحة اضافة الصورة

على كافة صفحات التعديل

t افتح محدد الترجمة
ctrl+ s ارسال النموذج

على صفحات المناقشة

n انشى نقاش جديد
w تبديل حالة المتابعة
p تبديل عام / خاص
c تبديل اغلاق / فتح
a افتح الانشطة
r رد على النقاش
l انتقل لأخر رد
ctrl+ enter أرسل رسالتك
(السهم الايمن) الصفحة التالية
(السهم الايسر) الصفحة السابقة

الاعدادات

هل تريد تقييم او اضافة هذا العنصر للقائمة؟

تسجيل الدخول