[UPD ES] Filmaffinity 4.0

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.
antp
Site Admin
Posts: 9745
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: [UPD ES] Filmaffinity 4.0

Post by antp »

Microsoft is deprecating VBS, but you have time: it will be disabled by default (in new installs) in 2027 and removed only later :D

Next time I make an update to AMC I should try to add an option to use cURL, or at least a way to call it directly and discretely. I could do that easily by adding options to the Launch function (hide console, wait for app to close, ...)
Why do you need to create and execute a .ps1 rather than directly launching curl itself?
MrObama2022
Posts: 121
Joined: 2022-02-02 00:03:55

Re: [UPD ES] Filmaffinity 4.0

Post by MrObama2022 »

antp wrote: 2025-08-02 07:45:28 Why do you need to create and execute a .ps1 rather than directly launching curl itself?
Good point, I think ps1 file is useless and curl could be included in vbs, never tested. I got this solution by steps (first version was a nightmare). I don't know visualbasic or powershell, it's vibe coding ... you know, Gemini, Perplexity ...

If you want to switch to curl, you have to use a trick. The problem is that curl open the output file and then fill it with html so when you use FileExists inside your script you don't know really if file is already ready or not. That is why in my script I create it as .tmp and only after curl command is completer I rename it with the filename used in FileExists.

With Launch() this is how to do this:

Launch(curlPath, ' --silent -L -w "%output{' + InstallerPath + curlOutputTmp + '}" --output "' + InstallerPath + curlOutput + '" --url "' + address + '" ' + '-H "Accept: text/html, */*" [.......] -H "User-Agent: ' + curlUserAgent + '" 2>$null &');

With -w "%output{' + InstallerPath + curlOutputTmp + '}" the file curlOutputTmp is created only when curl command is completed. Then you can get the html that is in curlOutput

Code: Select all

    if (fileExists(InstallerPath + curlOutputTmp)) then
      DeleteFile(InstallerPath + curlOutputTmp);
      
    // please double check \" and fix, this is only a (working) test
    Launch(curlPath, ' --silent -L -w "%output{' + InstallerPath + curlOutputTmp + '}" --output "' + InstallerPath + curlOutput + '" --url "' + address + '" ' + '-H "Accept: text/html, */*" -H "Accept-Language: it" -H "DNT: 1" -H "Priority: u=0, i" -H "Sec-Ch-Ua: \"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"138\", \"Google Chrome\";v=\"138\"" -H "Sec-Ch-Ua-Mobile: ?0" -H "Sec-Ch-Ua-Platform: \"Windows\"" -H "Sec-Fetch-Dest: Document" -H "Sec-Fetch-Mode: Navigate" -H "Sec-Fetch-Site: None" -H "Sec-Fetch-User: ?1" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: ' + curlUserAgent + '" 2>$null &');

    cnt := 0;
    // wait max 1 minute
    while ((not fileExists(InstallerPath + curlOutputTmp)) AND (cnt < 120)) Do
    begin
      cnt := cnt + 1;
      Sleep(500);
    end;  
    if (fileExists(InstallerPath + curlOutputTmp)) then
    begin
      DeleteFile(InstallerPath + curlOutputTmp);
      if (fileExists(InstallerPath + curlOutput)) then
      begin
        fileContent := TStringList.Create;      
        fileContent.LoadFromFile(InstallerPath + curlOutput);
        Result := fileContent.Text;
        fileContent.Free;
        DeleteFile(InstallerPath + curlOutput); 
      end;
    end;
Taino75
Posts: 12
Joined: 2025-01-31 22:00:12

Re: [UPD ES] Filmaffinity 4.0

Post by Taino75 »

MrObama2022 wrote: 2025-07-30 08:36:29 Si tienes Windows 10 o Windows 11, haz lo siguiente: descarga este archivo y también este otro archivo en C:\ProgramData\Ant Movie Catalog\Scripts

Listo. Luego, con calma, intenta releer mi post y dime qué no te queda claro.
Gracias. Probado y funciona perfectamente, pero... ¡CUIDADO!

Ayer actualicé unas diez películas seguidas (como en un par de minutos) y no me ha dejado más... He intentado entrar en la WEB de FilmAffinity y me salía una alerta de "DEMASIADAS PETICIONES CONSECUTIVAS". Supongo que habrá que ir dejando un tiempo entre una película y otra para actualizar y que no salte este problema. (Entiendo que me detecta como BOT).
Hoy, por la mañana, ya me ha vuelto a dejar. Supongo que el problema fue el hacer tantas peticiones consecutivas y casi sin espacio de tiempo entre una y otra.

Un saludo - Gran trabajo.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Thanks. Tested and working perfectly, but... BE CAREFUL!

Yesterday I updated about ten movies in a row (in about a couple of minutes) and it wouldn't let me anymore... I tried to access the FilmAffinity website and got a "TOO MANY CONSECUTIVE REQUESTS" alert. I guess I'll have to leave some time between each movie to update and avoid this problem. (I understand it detects me as a BOT).
This morning, it let me again. I guess the problem was making so many consecutive requests with almost no time between them.

Best regards - Great work.
MrObama2022
Posts: 121
Joined: 2022-02-02 00:03:55

Re: [UPD ES] Filmaffinity 4.0

Post by MrObama2022 »

No soy español y no he hecho muchas pruebas con este script. Tu reporte es valioso: creo y espero poder modificar el script para identificar este error añadiendo un retraso cuando ocurra. Mejor aún, podría intentar prevenir el error añadiendo un retraso más pequeño entre una petición y otra. Sin embargo, no sé cuándo tendré tiempo para trabajar en ello…
masterchipo
Posts: 117
Joined: 2010-02-22 23:15:05

Re: [UPD ES] Filmaffinity 4.0

Post by masterchipo »

:clapping: :clapping:
MrObama2022 wrote: 2025-08-04 13:26:43 No soy español y no he hecho muchas pruebas con este script. Tu reporte es valioso: creo y espero poder modificar el script para identificar este error añadiendo un retraso cuando ocurra. Mejor aún, podría intentar prevenir el error añadiendo un retraso más pequeño entre una petición y otra. Sin embargo, no sé cuándo tendré tiempo para trabajar en ello…
No eres español, pero gracias a tu pericia y paciencia he logrado a pesar de las contingencias, dolores de cabeza y tiempo (sentado frente al monitor que tanto mal hace a mi columna) Mr. Knight Obama y Ragadast y a todos los implicados con esos dos scripts pude volver a cargar mis películas al catálogo de siempre.
Gracias a todos y al compañero antp
abrazo a todos :clapping: :clapping: :clapping: :grinking:
Taino75
Posts: 12
Joined: 2025-01-31 22:00:12

Re: [UPD ES] Filmaffinity 4.0

Post by Taino75 »

MrObama2022 wrote: 2025-08-04 13:26:43 No soy español y no he hecho muchas pruebas con este script. Tu reporte es valioso: creo y espero poder modificar el script para identificar este error añadiendo un retraso cuando ocurra. Mejor aún, podría intentar prevenir el error añadiendo un retraso más pequeño entre una petición y otra. Sin embargo, no sé cuándo tendré tiempo para trabajar en ello…
Este es el problema que aparece cuando usas el sript varias veces consecutivas:
This is the problem that appears when you use the script several times in a row:
https://drive.google.com/file/d/1VnU1P_ ... sp=sharing
Post Reply