The Movie Database Support

When pulling from the API using my API Key, I am getting results that do not appear to be sorted properly. All of these seem to have issues...

By Popularity - when displaying the popularity of the titles, they are not sorted in descending order as requested

/discover/movie?page=1&with_original_language=en&language=en-US&adult=false&sortby=popularity.desc&with_release_type=4&primary_release_date.lte=2022-06-18

/discover/tv?page=1&with_original_language=en&language=en-US&adult=false&sortby=popularity.desc&air_date.lte=2022-06-18

By Release Date or Air Date - when displaying the release or air date of the titles, they are not sorted in descending order as requested

/discover/movie?page=1&with_original_language=en&language=en-US&adult=false&sortby=release_date.desc&vote_count.gte=100&with_release_type=4&primary_release_date.lte=2022-06-18

/discover/tv?page=1&with_original_language=en&language=en-US&adult=false&sortby=air_date.desc&vote_count.gte=100&air_date.lte=2022-06-18

Top Votes - when displaying the number of votes of the titles, they are not sorted in descending order as requested

/discover/movie?page=1&with_original_language=en&language=en-US&adult=false&sortby=vote_count.desc&vote_count.gte=5000&with_release_type=4&primary_release_date.lte=2022-06-18

/discover/tv?page=1&with_original_language=en&language=en-US&adult=false&sortby=vote_count.desc&vote_count.gte=5000&air_date.lte=2022-06-18

Is this an issue that is happening for everyone or just me? I am currently using API v3. I cannot tell what they are actually sorting by as it seems to be close to the right orders, but the titles are each off by a few positions one way or another.

Thanks, Wil

3 replies (on page 1 of 1)

Jump to last post

Figured I would post my results to try and illustrate what I mean...

Popular Movies Sort (Popularity score in parenthesis)

https://api.themoviedb.org/3/discover/movie?sortby=popularity.desc
https://api.themoviedb.org/3/movie/popular?language=en&region=US
  1. Doctor Strange in the Multiverse of Madness (7647.02)
  2. Fantastic Beasts: The Secrets of Dumbledore (3165.349)
  3. Sonic the Hedgehog 2 (2678.769)
  4. The Lost City (2361.103)
  5. Jurassic World Dominion (2133.719)
  6. Memory (2112.845)
  7. Morbius (2103.588)
  8. Spider-Man: No Way Home (1894.244)
  9. Beyond Infinity: Buzz and the Journey to Lightyear (1873.37)
  10. The Northman (1830.809)
  11. Hustle (1628.178)
  12. Lightyear (1565.616) -- Starts to lose sort order from here --
  13. The Desperate Hour (1649.632)
  14. The Unbearable Weight of Massive Talent (1585.815)
  15. Turning Red (1518.866)
  16. Dragon Ball Super: Super Hero (1455.53)
  17. Interceptor (1443.333)
  18. Dog (2005.87)
  19. Uncharted (1293.333)
  20. Clean (1203.221)

Popular TV Shows Sort (Popularity score in parenthesis)

https://api.themoviedb.org/3/discover/tv?sortby=popularity.desc
https://api.themoviedb.org/3/tv/popular?language=en&region=US
  1. The Boys (3124.756) -- Starts to lose sort order from here --
  2. Ms. Marvel (3024.312)
  3. Obi-Wan Kenobi (3088.736)
  4. Stranger Things (2441.871)
  5. Peaky Blinders (1661.774)
  6. 2 Good 2 Be True (1457.443)
  7. Halo (1505.784)
  8. Euronews Hoy (1325.125)
  9. Love Island Spain (841.196)
  10. Bisik-Bisik Gelora (1412.258)
  11. SPY x FAMILY (1338.628)
  12. Cara e Coragem (1384.89)
  13. Pantanal (1297.709)
  14. Lang Leve de Liefde (1317.253)
  15. Bluey (748.068)
  16. Além da Ilusão (898.874)
  17. Moon Knight (918.955)
  18. Grey's Anatomy (895.354)
  19. Power Couple Brasil (814.766)
  20. Super Dragon Ball Heroes (832.329)

Movie Vote Sort (Vote count in parenthesis)

https://api.themoviedb.org/3/discover/movie?sortby=vote_count.desc
  1. Doctor Strange in the Multiverse of Madness (2915)
  2. Fantastic Beasts: The Secrets of Dumbledore (1941) -- Starts to lose sort order from here --
  3. Sonic the Hedgehog 2 (2152)
  4. The Lost City (1274)
  5. Jurassic World Dominion (727)
  6. Memory (341)
  7. Morbius (1774)
  8. Spider-Man: No Way Home (13670)
  9. Beyond Infinity: Buzz and the Journey to Lightyear (102)
  10. The Northman (1615)
  11. Hustle (711)
  12. Lightyear (213)
  13. The Desperate Hour (132)
  14. The Unbearable Weight of Massive Talent (341)
  15. Turning Red (2552)
  16. Dragon Ball Super: Super Hero (42)
  17. Interceptor (305)
  18. Dog (434)
  19. Uncharted (2488)
  20. Clean (137)

Release Date Sort (Release date in parenthesis)

https://api.themoviedb.org/3/discover/movie?sortby=release_date.desc
  1. Doctor Strange in the Multiverse of Madness (2022-05-04)
  2. Fantastic Beasts: The Secrets of Dumbledore (2022-04-06)
  3. Sonic the Hedgehog 2 (2022-03-30)
  4. The Lost City (2022-03-24) -- Starts to los sort order from here --
  5. Jurassic World Dominion (2022-06-01)
  6. Memory (2022-04-28)
  7. Morbius (2022-03-30)
  8. Spider-Man: No Way Home (2021-12-15)
  9. Beyond Infinity: Buzz and the Journey to Lightyear (2022-06-10)
  10. The Northman (2022-04-07)
  11. Hustle (2022-06-03)
  12. Lightyear (2022-06-15)
  13. The Desperate Hour (2021-09-12)
  14. The Unbearable Weight of Massive Talent (2022-04-20)
  15. Turning Red (2022-03-10)
  16. Dragon Ball Super: Super Hero (2022-06-11)
  17. Interceptor (2022-05-26)
  18. Dog (2022-02-17)
  19. Uncharted (2022-02-10)
  20. Clean (2022-01-28)

Is it possible that I am maybe not understanding what is being sorted by?

Thanks, Wil

Hi Wil,

A few things:

The param you're looking for is sort_by not sortby.

Also, when choosing any sort orders by date, unless you use primary_release_date, you'll always want to use the region filter. Since multiple release dates can exist on any particular item per country, and you're not specifying a with_release_type, the earliest date is always used. However, that might not be what is displayed since you're not specifying with_release_type. The default chosen order for release types are (in order) [2,3,1,4,5,6] I do believe.

Lastly, there is no guaranteed sync between the state of these three things:

  1. When the popularity job runs every day
  2. The last time discover got synced
  3. The state of the individual cached item

All three of these individually, and especially together, will introduce some of the small differences you're noticing. We're not really concerned about everything needing to be 100% accurate (eventual sync is fine) as it's a general discovery engine and these nuances are ok with us.

Perfect, thank you so much Travis! That helped a ton!!

I had previously had the sortby set to sort_by but I must have accidentally re-typed it wrong in a previous update. I had omitted the other parameters for simplicity but I do have with_release_type included in all of my requests.

Thank you for the additional info on the release type order and on the region requirement. Already tested them out and things are running well now.

Much appreciated, Wil

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