Incomplete Information using IMDB Script

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
Guest_2691
Posts: 6
Joined: 2023-04-03 22:00:39

Re: Incomplete Information using IMDB Script

Post by Guest_2691 »

Hello, antp. I tested a new code and it seems to work at all. It gets information from reference page. You can add it as a third option to the script if you like.
This is the code:

Code: Select all

begin
    originalTitle := TextBefore(PageText, '</h3>', '(original title)');
    if originalTitle ='' then originalTitle := TextBetween(PageText,'<h3 itemprop="name">', '<span class="titlereference-title-year">');
    HTMLRemoveTags(originalTitle);
    HTMLDecode(originalTitle);
    originalTitle := RemoveSpaces(originalTitle, true);
    if (originalTitle <> '') and CanSetField(fieldTranslatedTitle) then
    SetField(fieldTranslatedTitle, FullTrim(originalTitle));
end;
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Incomplete Information using IMDB Script

Post by antp »

Thanks I'll check that.
Indeed for Belgium the translated title is more tricky: as there are multiple languages in the country, depending on the language of the person it will be either the French title (same as in France), or just the original title for Dutch-speaking people.
But IMDb does not have that info based on the IP address, they just have the country info.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Incomplete Information using IMDB Script

Post by antp »

I've put a new version 4.024 with that as option 3, and also fixed the code for the Akas page of option 2.
Depending on the cases, it is not always the same option which works the best.
Also, when the original title is not English, it does not seem to always pick a translated one, though that in that case it could take the original title as original title, and the main IMDb title (English) as translated title.
Dorohedoro
Posts: 39
Joined: 2016-12-13 00:45:45

Re: Incomplete Information using IMDB Script

Post by Dorohedoro »

Guest_2691 wrote: 2023-04-10 18:00:17
Dorohedoro wrote: 2023-04-09 19:04:03 I'm having issues with the awards, the script is not taking that field of information. I'm using the lastest version of the script.

Thanks!
Here the script is working for Awards. In Script Options you must set Awards to 1 or 2 according to your preference. In fact, Awards information is put in the field Description after summary or in the field Comments.
I have it on "1" since almost 7 years, It's random for me, sometimes works sometimes don't.
Guest_2691
Posts: 6
Joined: 2023-04-03 22:00:39

Re: Incomplete Information using IMDB Script

Post by Guest_2691 »

Dorohedoro wrote: 2023-04-13 18:11:28
Guest_2691 wrote: 2023-04-10 18:00:17
Dorohedoro wrote: 2023-04-09 19:04:03 I'm having issues with the awards, the script is not taking that field of information. I'm using the lastest version of the script.

Thanks!
Here the script is working for Awards. In Script Options you must set Awards to 1 or 2 according to your preference. In fact, Awards information is put in the field Description after summary or in the field Comments.
I have it on "1" since almost 7 years, It's random for me, sometimes works sometimes don't.
I can't figure out why this happens. Maybe a user with more knowledge about coding could help you.
Guest_2691
Posts: 6
Joined: 2023-04-03 22:00:39

Re: Incomplete Information using IMDB Script

Post by Guest_2691 »

antp wrote: 2023-04-13 14:16:27 I've put a new version 4.024 with that as option 3, and also fixed the code for the Akas page of option 2.
Depending on the cases, it is not always the same option which works the best.
Also, when the original title is not English, it does not seem to always pick a translated one, though that in that case it could take the original title as original title, and the main IMDb title (English) as translated title.
Hello. The main issue with the Option 2 is that the script can't manage to get into the collapsed list of aka names. It isn't shown on page source. I don't really know if there's a function to do the trick. Anyway I think the IMDB script now is serviceable enough for most cases.
Thanks and best regards.
MrObama2022
Posts: 58
Joined: 2022-02-02 00:03:55

Re: Incomplete Information using IMDB Script

Post by MrObama2022 »

Just released ItalianMultisite latest beta

Too few tests, so I don't know if it's stable. What's interesting is RapidAPI free account support so I can retrieve all iMDB translated titles (aka) without speed loss.

Ah, by the way I didn't get what's the matter with the charset :hmh: but I found a way to translate it :p ...
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Incomplete Information using IMDB Script

Post by antp »

Guest_2691 wrote: 2023-04-14 03:32:49 The main issue with the Option 2 is that the script can't manage to get into the collapsed list of aka names. It isn't shown on page source. I don't really know if there's a function to do the trick.
Indeed, it is the main problem with that page. Maybe there is a way to retrieve that list, but the first tests I made were not conclusive.
MrObama2022
Posts: 58
Joined: 2022-02-02 00:03:55

Re: Incomplete Information using IMDB Script

Post by MrObama2022 »

I just introduced further improvements in my (local) iMDB library. Now I get the akas from iMDB and only if akas are more then 5 I call RapidAPI (so I use RapidAPI only if really needed). If a user does not have a RapidAPI free account, he get no more then 5 akas.

Now I have just to finalize charset translation (to translate some characters and skip unconvertible titles).

I hope I can release it in next days. By the way, maybe I can help to integrate this solution in iMDB.ifs (but I have really no free time ...)
MrObama2022
Posts: 58
Joined: 2022-02-02 00:03:55

Re: Incomplete Information using IMDB Script

Post by MrObama2022 »

I improved charset decoding. Now I'm testing with vietnamese and turkish titles. I think I can release in next days.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Incomplete Information using IMDB Script

Post by antp »

Nice, thanks for your work :)
I don't have a lot of free time for AMC either, but if you don't have time to include it in the IMDb script maybe I can do it then.
MrObama2022
Posts: 58
Joined: 2022-02-02 00:03:55

Re: Incomplete Information using IMDB Script

Post by MrObama2022 »

I think I can add to IMDB.ifs in next days :grinking:
Of course I will not add all my code and pas files, I simply add 2 or 3 functions inside IMDB.ifs to let it use RapidAPI (if a RapidAPI key is given).
MrObama2022
Posts: 58
Joined: 2022-02-02 00:03:55

Re: Incomplete Information using IMDB Script

Post by MrObama2022 »

Here a IMDB.ifs beta.

I had few tests on my PC and it worked. To test you need to have the latest AMC beta.
There is a parameter, RapiAPIKey, where you can set the free rapidapi key. If you don't set one, rapidapi will not be used and nothing changes.

The option TranslatedTitle works as before but if no new title is found then it use rapidapi. So the default value, 3, could not be the better (at least non for any country) so if you get bad results set TranslatedTitle to 2 and everything will work. I also added a new value for TranslatedTitle and it's 4: with 4 all titles are used (with || delimiter) and the title(s) of your country are in first positions, followed by worldwide and us titles, then all the others.

Country supported are all countries with languages compliant with Windows-1252 charset. Vietnamese country is not supported at all (vietnamese titles are skipped at the moment, sorry), other countries could be supported. Japanese, chinese, taiwan and other languages are not supported at all (but if Japan title is written in english is supported).

I added retrieveTitlesFromRapidAPI procedure and decodeRapidApiCharsetToCP1252 function. Final code is compact, I use utf8decode and not my personal function (utf8decode is too strict but it's usable, you could have some ? with romanian titles), of course I had to apply a fix before utf8decode because there is something weird using utf8decode with rapidapi. I updated AKACountry and it's huge now, sorry, I think it could be shrinked.

Please test and let me know if it works for you (I'll test it again in next days too).
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Incomplete Information using IMDB Script

Post by antp »

Thanks for your work!

One improvement maybe, I see that you kept the "CheckVersion(4,2,2)" which is good so the script still works on current official version of AMC, but maybe it would be good to add a "CheckVersion(4,2,3)" before trying to use "GetPage5" (or even before "retrieveTitlesFromRapidAPI") to avoid errors in such case?
MrObama2022
Posts: 58
Joined: 2022-02-02 00:03:55

Re: Incomplete Information using IMDB Script

Post by MrObama2022 »

Absolutely, I upgraded the version in the Infos but I forget to upgrade in the main function, here the upgraded version. Modify the script as you like and, by the way, if you don't like TranslatedTitle 4 option you can comment it.

I'm doing further tests in next days.
Dorohedoro
Posts: 39
Joined: 2016-12-13 00:45:45

Re: Incomplete Information using IMDB Script

Post by Dorohedoro »

I'm still having issues with the Awards info, sometimes works, sometimes don't. I think there is a problem with the script.

Image
MrObama2022
Posts: 58
Joined: 2022-02-02 00:03:55

Re: Incomplete Information using IMDB Script

Post by MrObama2022 »

Hi @Dorohedoro, which is the AWARDS value the script should show? I can't find any here: https://www.imdb.com/title/tt0052583/

Maybe I can help to fix this field
Dorohedoro
Posts: 39
Joined: 2016-12-13 00:45:45

Re: Incomplete Information using IMDB Script

Post by Dorohedoro »

MrObama2022 wrote: 2023-05-02 14:17:27 Hi @Dorohedoro, which is the AWARDS value the script should show? I can't find any here: https://www.imdb.com/title/tt0052583/

Maybe I can help to fix this field
Hi!

When working it should look like this:

Image

I think it's because imdb changed the awards page layout.

Thank you so much!
MrObama2022
Posts: 58
Joined: 2022-02-02 00:03:55

Re: Incomplete Information using IMDB Script

Post by MrObama2022 »

Ok, thank you so much for this example, I see the problem. I'll work at it in next days
Dorohedoro
Posts: 39
Joined: 2016-12-13 00:45:45

Re: Incomplete Information using IMDB Script

Post by Dorohedoro »

MrObama2022 wrote: 2023-05-03 00:00:30 Ok, thank you so much for this example, I see the problem. I'll work at it in next days
Thank you so much!
Post Reply