The Movie Database Support

Hi,

I am new to the TMDB API and am trying to retrieve a list of movies from a specific year that have Albanian as their original language. However, I’m encountering some challenges with pagination and filtering.

I’m currently using the following API endpoint to get movies for the year 2022 with Albanian as the original language: https://api.themoviedb.org/3/discover/movie?api_key=MY_API_KEY&primary_release_year=2022&original_language=sq

The issue I’m facing is that the API returns results one page at a time, and given the large number of pages, it’s impractical to make a request for each page. Additionally, I’ve encountered a limit of 500 pages.

Could you please advise on the best approach to:

Efficiently retrieve all movies for a given year that match the specified original language. Handle the pagination effectively to avoid making excessive requests. Any guidance or alternative methods for achieving this would be greatly appreciated.

Thank you for your assistance.

Best regards, Fitore

2 replies (on page 1 of 1)

Jump to last post

Efficiently retrieve all movies for a given year that match the specified original language.

Using discover method with primary_release_year= parameter is the way, but as for the language, you should use with_original_language= parameter, because original_language= parameter doesn't exist - see more here

Handle the pagination effectively to avoid making excessive requests.

You must retrieve all pages separately (using page= parameter). If you want to speed things up, you can query first page to get a number of pages to retrieve and then fetch all remaining pages in parallel. Just keep in mind that you should throttle your request to API limit which is 50 requests per second.

You are amazing! I missed the with part and when I added that to the link all the movies for that year with that language showed up. Thank you so much for your help!

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login