The Movie Database Support

I have tried using the region=US at the end of my api call URL but that does not help. I am trying to randomly generate titles, but I want them to only be coming from the US

7 replies (on page 1 of 1)

Jump to last post

@technicallyoutdoors said:
How can I get TV/Movie ID's that are ONLY in the US?
I have tried using the region=US at the end of my api call URL but that does not help.
I am trying to randomly generate titles, but I want them to only be coming from the US

Produced in the US or currently showing in the US?
If you can, post here the API Request you used.

Problems with API Request

In order for someone to help you with API Request questions,
it is critical that you post here the API Request you are sending to the TMDb server.
Remember to replace your Key with MY_KEY , YOUR_KEY , THE_KEY , or something like that.

Not the programming code/script you used to build the API Request.
But the API Request that is sent to the TMDb server.
Or the API Request you would like to send.

url = "https://api.themoviedb.org/3/movie/latest?api_key=MYAPIKEY&language=en-US®ion=US"
response = requests.get(url)
data = response.json()
movie_id = data['id']

print(data)

Here is the example of how I am calling the api. I am using a random generator to create a movie id and then check against the API to test if it has specific key values in it and then getting the image and title name. I want to only do this for movies/tv shows in the US because I tested it and I am getting a bunch of weird random shows/movies in russian and other languages.

while True:
    choice = generate_random_id()
    print(choice)

    # Fetch data for the TV show
    url3 = "https://api.themoviedb.org/3/movie/" + str(choice) + "?api_key=MYAPIKEY&language=en-US®ion=US"
    response3 = requests.get(url3)
    data3 = response3.json()

    # Check if original_name is in data3
    if 'original_title' in data3:
        movie_name = data3['original_title']
    else:
        # If original_name is not in data3, continue to the next iteration of the loop
        continue

this is all done in python, by the way

Thanks in advanced!

@technicallyoutdoors said:

url = "https://api.themoviedb.org/3/movie/latest?api_key=MYAPIKEY&language=en-US®ion=US"
response = requests.get(url)
data = response.json()
movie_id = data['id']

print(data)

Here is the example of how I am calling the api. I am using a random generator to create a movie id and then check against the API to test if it has specific key values in it and then getting the image and title name. I want to only do this for movies/tv shows in the US because I tested it and I am getting a bunch of weird random shows/movies in russian and other languages. ... Thanks in advanced!

Now I think I understand.
This API Request, latest, always reports the last movie, and only the last one, added to the Database.
Regardless of origin, language or anything else.
And no other filter, region for example, works with it.
I tested it now and received a movie without a poster and pornographic.

Some users with a goal similar to yours received some suggestions for the problem.
Usually using Discover Request, filtering by release date, region, original language, sorted by primary_release_date or vote_average and any of the countless other possible filters.
But there remains the problem of "random".
Some solved it by creating a sequence of page choice (0 to 50) and item (0 to 19) of the answer.
The advantage is that all items are in accordance with the chosen filters.

Or download the daily file of the list of valid IDs.
I believe it comes with the latest added right at the beginning.
But without any filter.
https://developers.themoviedb.org/3/getting-started/daily-file-exports

okay, so then once I get that file I can just pick a random one there? Can I specify that I want only the titles in the US, or is that what you mean by no filter?

It also seems that this example file is not available? I cannot attach a screenshot, otherwise I would example file

The example file is from 2017. Grab yesterday's: http://files.tmdb.org/p/exports/movie_ids_04_22_2023.json.gz

@technicallyoutdoors said:
okay, so then once I get that file I can just pick a random one there?
Can I specify that I want only the titles in the US, or is that what you mean by no filter?

It also seems that this example file is not available?
I cannot attach a screenshot, otherwise I would example file

ATTENTION: See the date format. MM_DD_YYYY
http://files.tmdb.org/p/exports/movie_ids_04_22_2023.json.gz
This file tells original title and ID, basically.
Here's an example I downloaded a while ago:

{"adult":false,"id":3924,"original_title":"Blondie","popularity":2.596,"video":false}
{"adult":false,"id":6124,"original_title":"Der Mann ohne Namen","popularity":1.341,"video":false}
{"adult":false,"id":8773,"original_title":"L'amour à vingt ans","popularity":5.117,"video":false}
{"adult":false,"id":25449,"original_title":"New World Disorder 9: Never Enough","popularity":1.79,"video":false}
{"adult":false,"id":31975,"original_title":"Sesame Street: Elmo Loves You!","popularity":0.6,"video":true}
{"adult":false,"id":2,"original_title":"Ariel","popularity":6.72,"video":false}
{"adult":false,"id":3,"original_title":"Varjoja paratiisissa","popularity":6.704,"video":false}
{"adult":false,"id":5,"original_title":"Four Rooms","popularity":10.999,"video":false}
{"adult":false,"id":6,"original_title":"Judgment Night","popularity":11.196,"video":false}
{"adult":false,"id":8,"original_title":"Life in Loops (A Megacities RMX)","popularity":1.568,"video":false}
{"adult":false,"id":9,"original_title":"Sonntag im August","popularity":2.137,"video":false}
{"adult":false,"id":11,"original_title":"Star Wars","popularity":59.602,"video":false}
{"adult":false,"id":12,"original_title":"Finding Nemo","popularity":83.69,"video":false}  

Thank you SO much. Utilizing the discover api call actually fixed my issue and was super easy to get all the data I needed - thanks 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