Υποστήριξη για το The Movie Database

Hi Team,

I am working on an assignment and am using the https://api.themoviedb.org/3/discover/movie for download the complete dataset of movies. On first call, API returns "total_pages": 38719, "total_results": 774367.

I am using the API in recursive mode by adding the page parameter in every call. But after 61 pages API return error "cURL error 56: OpenSSL SSL_read: Connection reset by peer".

Can you please suggest, how can we get the complete data from the API.

Thanks

5 απαντήσεις(στη σελίδα 1 από 1)

Jump to last post

Hi @netsmartz, there are several things to look at here.

download the complete dataset of movies

This api isn't designed for a user to download everything. Queries are limited to a maximum of 500 pages to download. If you try to download any page > 500 you will get an error. In theory you could break the query up into smaller pieces, for example, by year, but that would be up to you. Another option is the daily file exports, but these only have a bare minimum of information about each title.

I am using the API in recursive mode

Maybe this is just a matter of semantics, but I'm not sure why you would do this using recursion. Most would use a simple loop in synchronous coding, or start a specific number of tasks in asynchronous coding. Recursion would mean you are nesting your calls for each page, so you would have to nest the calls 38719 levels deep, one for each page. There are some basic rate limiting done on this site, I believe it is something like 40 calls per second and 20 simultaneous calls per ip address, so you could be hitting one of these limits using a recursive method. Or, it could be simply a transient one time problem.

Thanks Team, for the update.

our model is working like that-

  1. We make an API call to get the Total Pages
  2. Make multiple API calls in for loop upto Total Pages (got in Step 1) including the Page parameter (incremented value)
  3. We successfully get the data upto 61 pages.
  4. After 61 page, we get the error ** "cURL error 56: OpenSSL SSL_read: Connection reset by peer"**

My suggestion would be to run this at least several times to look for three possibilities.

  1. It was a transient problem and it doesn't happen again.
  2. It happens randomly.
  3. It always happens exactly after page 61.

You might also add the "-v" option to curl to see more output and compare output when it works and when it doesn't. Also it might be useful to know exactly what api call you are making. Mask out your api key before you post it here.

It always happens exactly after page 61. Also how can I get the data of pages > 500 ?

Also how can I get the data of pages > 500 ?

You can't. You would have to run different queries to get more results. Some options are explained in the first paragraph of the first reply.

It always happens exactly after page 61.

I would try running the query starting on the first page that fails first. For example, "...query...&page=62". That will determine if it is that specific page or because you ran 61 queries before. You might also add the "-v" option to curl to see more output and compare output when it works and when it doesn't. Also it would be useful to know exactly what api call you are making. Mask out your api key before you post it here. Also would help to see a section of code where you are running the queries.

Δεν μπορείτε να βρείτε κάποια ταινία ή σειρά; Συνδεθείτε για να τη δημιουργήσετε.

Σε όλες τις σελίδες

s Εστίαση στη μπάρα αναζήτησης
p Άνοιγμα μενού προφίλ
esc Κλείσιμο ανοιχτού παραθύρου
? Άνοιγμα παραθύρου συντομεύσεων πληκτρολογίου

Στις σελίδες μέσων

b Επιστροφή στην προηγούμενη σελίδα(ή στην αρχική σελίδα όταν είναι εφικτό)
e Μετάβαση στη σελίδα επεξεργασίας

Στις σελίδες κύκλων σειρών

(Δεξιό βέλος) Μετάβαση στον επόμενο κύκλο
(Αριστερό βέλος) Μετάβαση στον προηγούμενο κύκλο

Στις σελίδες επεισοδίων σειρών

(Δεξιό βέλος) Μετάβαση στο επόμενο επεισόδιο
(Αριστερό βέλος) Μετάβαση στο προηγούμενο επεισόδιο

Σε όλες τις σελίδες εικόνων

a Άνοιγμα παραθύρου προσθήκης εικόνας

Σε όλες τις σελίδες επεξεργασίας

t Άνοιγμα επιλογέα μετάφρασης
ctrl+ s Υποβολή φόρμας

Στις σελίδες συζήτησης

n Δημιουργία νέας συζήτησης
w Ρύθμιση κατάστασης παρακολούθησης
p Ρύθμιση ως δημόσια/ιδιωτική
c Ρύθμιση ανοίγματος/κλεισίματος
a Άνοιγμα δραστηριότητας
r Απάντηση στη συζήτηση
l Μετάβαση στην τελευταία απάντηση
ctrl+ enter Υποβολή μηνύματος
(Δεξιό βέλος) Επόμενη σελίδα
(Αριστερό βέλος) Προηγούμενη σελίδα

Ρυθμίσεις

Θέλετε να αξιολογήσετε ή να προσθέσετε αυτό το στοιχείο σε μια λίστα;

Σύνδεση