PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Importing Movie Info from IMDB
Importing Movie Info from IMDB
Débuté par Stephan Wiestner, 28 mar. 2021 18:52 - 7 réponses
Membre enregistré
10 messages
Posté le 28 mars 2021 - 18:52
Hi
Another "Where to start?" question. You see, I'm nearly retired now and now I have time to program for my hobby.
Question is how can I import Information out of IMDB in my windev project? Anyone who did this in this forum?
Thanks for your help and kind regards from sunny Switzerland
Stephan
Posté le 29 mars 2021 - 01:52
Check this out: https://imdb-api.com
Membre enregistré
10 messages
Posté le 30 mars 2021 - 07:45
Thanks Bob! Works perfect!
Posté le 02 avril 2021 - 23:47
Would it be possible to give me a short description about how to proceed
when using this API?

A short code example would help.

I have nerver used anything like it, and the documentation is not really
present.


Denis
Membre enregistré
10 messages
Posté le 03 avril 2021 - 11:17
Hi Denis
welcome to the club! It was the first API for me, too! But with the help of Bob you get everything running.

Url is string
HTTP_Res is JSON, Description ="IMDB-API-SearchResult"
//IMDB-API-SearchResult is an external file descipton it looks like this (see image)
//Just run the call without description, debug the result and save it as json file (then you have your desription)
//after entered the description, you can

https://hostimage.windev.io/images/test_d1ccc44b4f1ad7b85f8f2f224f7931c5.png
HTTPError is string
lcMovieToSearch is string = Replace(MovietoSearch," ","%20")

Url = StringBuild("https://imdb-api.com/%1/API/%2/%3/%4","EN","SearchMovie",gcIMDBAPIKey,lcMovieToSearch)
// gcIMDBAPIKey is your personal API key you receive when registering
//lcMovietosearch is the name of the movie you are looking for (all spaces replaced with %20

IF httpRequest(Url) THEN
// The request was sent, it was a valid URL
HTTP_Res = HTTPGetResult()
IF Length(HTTP_Res) = 0 THEN
// Error of the Web server,
// the error details can be found in the page header
HTTPError = HTTPGetResult(httpHeader)
Error(HTTPError)
RETURN
END
ELSE
HTTPError = HTTPGetResult(httpHeader)
Error(HTTPError)
RETURN
END


after you have entered the description, you can just reference it as normal variables

lnIndex = 0
lnMaxIndex = HTTP_Res.results..Count
// check to find out how many lines the result has

TableDeleteAll(Table_Result)

FOR lnIndex = 1 TO lnMaxIndex
TableAddLine(Table_Result,HTTP_Res.results[lnIndex].id, HTTP_Res.results[lnIndex].title, HTTP_Res.results[lnIndex].description, HTTP_Res.results[lnIndex].image)
END
IF Table_Result..Count THEN
ListSelectPlus(Table_Result,1)
BrowseImage = Table_Result.Image
END

HTH
Have Fun!
Membre enregistré
10 messages
Posté le 03 avril 2021 - 11:21
Stephan Wiestner wrote:
Hi Denis
welcome to the club! It was the first API for me, too! But with the help of Bob you get everything running.

Url is string
HTTP_Res is JSON, description ="IMDB-API-SearchResult"
//IMDB-API-SearchResult is an external file descipton it looks like this (see image)
//Just run the call without description, debug the result and save it as json file (then you have your desription)

HTTPError is string
lcMovieToSearch is string = Replace(MovietoSearch," ","%20")

Url = StringBuild("https://imdb-api.com/%1/API/%2/%3/%4","EN","SearchMovie",gcIMDBAPIKey,lcMovieToSearch)
// gcIMDBAPIKey is your personal API key you receive when registering
//lcMovietosearch is the name of the movie you are looking for (all spaces replaced with %20

IF HTTPRequest(Url) THEN
// The request was sent, it was a valid URL
HTTP_Res = HTTPGetResult()
IF Length(HTTP_Res) = 0 THEN
// Error of the Web server,
// the error details can be found in the page header
HTTPError = HTTPGetResult(httpHeader)
Error(HTTPError)
RETURN
END
ELSE
HTTPError = HTTPGetResult(httpHeader)
Error(HTTPError)
RETURN
END


after you have entered the description, you can just reference it as normal variables

lnIndex = 0
lnMaxIndex = HTTP_Res.results..Count
// check to find out how many lines the result has

TableDeleteAll(Table_Result)

FOR lnIndex = 1 TO lnMaxIndex
TableAddLine(Table_Result,HTTP_Res.results[lnIndex].id, HTTP_Res.results[lnIndex].title, HTTP_Res.results[lnIndex].description, HTTP_Res.results[lnIndex].image)
END
IF Table_Result..Count THEN
ListSelectPlus(Table_Result,1)
BrowseImage = Table_Result.Image
END

HTH
Have Fun!


Image was badly positioned, sorry



Posté le 03 avril 2021 - 21:42
Stephan,

Thank you.

I will study the code, and see how it goes.

Denis
Posté le 11 mai 2023 - 00:46
Bonjour,

Pourrait on avoir le code complet en exemple d'utilisation de l'API IMDB ?

J'essaie de comprendre les codes ci-dessus, mais j'ai l'impression qu'il manque pas mal de petites choses pour le faire fonctionner.

Ou existe-t-il un exemple complet de code permettant d'utiliser l'API d'IMDB pour essayer de créer une petite appli de gestion de film ?

Merci beaucoup d'avance

Cordialement