دعم الموقع

I wanna search movie in my NextJS app, but I wanna show directors names below the title. But adding "append_to_reponse=credits" in the search query isn't working :

const results = await (await fetch(`${process.env.NEXT_PUBLIC_TMDB_API_URL}search/movie?query=${query}&include_adult=false&api_key=${process.env.NEXT_PUBLIC_TMDB_API_KEY}&language=${language}&page=${page}&append_to_response=credits`)).json()

And requesting credits for each movie seems excessive in terms of API request consumption. What the solution ?

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

Jump to last post

I do not believe it is possible to use append_to_response with something like a search query.

All of the example uses on the docs show it working with a specific ID in mind:
https://developer.themoviedb.org/docs/append-to-response

A staff member confirmed it's not possible in another thread asking a related question here:
https://www.themoviedb.org/talk/5cab56d80e0a264c8bf66e11

And requesting credits for each movie seems excessive in terms of API request consumption.

This is exactly what it would be doing anyways if you were to append credits details to a search query, database consumption wise.

Ultimately I think the best method is to show the basic details from your search and let the user click on the individual movie they are most interested in to see these more specific details, when the user does that, it would then make your specific call to the credits and others.

This is how I implemented it on my project.

@loupqhc said:

I wanna search movie in my NextJS app, but I wanna show directors names below the title. But adding "append_to_reponse=credits" in the search query isn't working :

const results = await (await fetch(`${process.env.NEXT_PUBLIC_TMDB_API_URL}search/movie?query=${query}&include_adult=false&api_key=${process.env.NEXT_PUBLIC_TMDB_API_KEY}&language=${language}&page=${page}&append_to_response=credits`)).json()

And requesting credits for each movie seems excessive in terms of API request consumption. What the solution ?

Justin is correct.
API Request of type Search does not support "append_to_reponse=" feature.
You will only be able to use "append_to_reponse=", for example using movie "details" to get credits.
https://developer.themoviedb.org/reference/movie-details

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

عام

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

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

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

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

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

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

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

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

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

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

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

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

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

الاعدادات

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

تسجيل الدخول