The Movie Database Support

Thanks for this API!

Running into a strange bug... The following code works great for a list of movies, but for a list of TV shows, it returns the correct total_results and object_ids, but the results array is empty.

Any idea why?

const fetch = require(`node-fetch`);
const Bottleneck = require(`bottleneck`);

const limiter = new Bottleneck({
  reservoir: 40, // max requests
  reservoirRefreshAmount: 40,
  reservoirRefreshInterval: 10 * 1000, // time span
  maxConcurrent: 1,
  minTime: 10000 / 40 // avg MS per request

async function fetchTMDBListData(listId) {
  let items = [];
  let page = 1;
  let totalPages;

  async function fetch20Items() {
    return await fetch(
        headers: {
          Accept: "application/json",
          Authorization: `Bearer ${process.env.TMDB_READ_ACCESS_TOKEN}`

  do {
    try {
      const response = await limiter.schedule(() => fetch20Items());
      const data = await response.json();
      totalPages = data.total_pages;
    } catch (error) {
      console.log("fetchTMDBListData error", error);

  } while (page <= totalPages);

  return Promise.all(items);

2 replies (on page 1 of 1)

Jump to last post

Nevermind! It was just the sort_by value.

When querying the tv api, release_date needs to become primary_release_date .

Hi @ooloth,

Yes, I believe the common date sort field I setup for lists is primary_release_date. Otherwise on TV, I always use first_air_date. This is the same as how discover works.

Anyways, happy to hear you sorted it.


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