Page 1 of 1

Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Tue Feb 01, 2022 9:46 am
by Fermin
Hello.

Some time ago I made a LiveCode application to download newspaper covers (jpg files) from a website (https://es.kiosko.net/) and it worked perfectly. I haven't used it for a few months and now, when I try it again I see that it only downloads empty files (0 bytes).
I use the libURLDownloadToFile command.

I've tried with another website -although it's not the one I'm interested in- and it downloads fine. For example, the same cover offered by two different websites. They exist but libURLDownloadToFile doesn't download it on one of them:

With the website I'm interested in.
The cover is there but I DON'T GET libURLDownloadToFile to download it.
https://img.kiosko.net/2022/02/01/es/elmundo.750.jpg

With another website. It does work:
https://www.lasportadas.es/data/2022/20 ... MundoI.jpg

What could be happening?

Thank you very much.

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Tue Feb 01, 2022 2:54 pm
by Klaus
Hi Fermin,

no problem here with that file!?
macOS 12.1, LC 9.66

Did you check the URLStatus like I did?
May give a hint on what is going on.


Best

Klaus

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Tue Feb 01, 2022 5:42 pm
by Fermin
Hi Klaus, nice to greet you.

Using your code I have the same problem, on one site (lasportadas.es) it works but on KIOSKO.NET, it does not.
Can you download the correct file from kiosko.net?

in mouseUp
/*220201-1659*/
put "https://img.kiosko.net/2022/02/01/es/elmundo.750.jpg" in tUrl -- tStatus = "error". Filesize: 0 bytes
put "https://www.lasportadas.es/data/2022/20 ... MundoI.jpg" into tUrl -- tStatus = "downloaded". File size: 219 kb
put specialfolderpath ("desktop") & "/d_test.jpg" into tFile
libURLDownloadToFile tUrl,tFile, "itisdone".
end mouseUp

-- ======================
on itisdone,tUrl,tStatus
put ""
put tUrl & cr & tStatus
end itisdone

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Tue Feb 01, 2022 5:55 pm
by Fermin
I'm using MacOS Sierra (10.12.6) with Livecode 9.0.0. and until a few months ago, everything worked correctly there. In fact I reserve that computer without updating because it seems to me that on later operating systems, LC has other problems. I have another computer with Monterey (version 12.1) and there I have downloaded Livecode version 9.6.5 using the 10 days trial but I don't decide to buy it because I don't see that it works very well either.

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Tue Feb 01, 2022 6:11 pm
by Klaus
Fermin wrote:
Tue Feb 01, 2022 5:42 pm
Using your code I have the same problem, on one site (lasportadas.es) it works but on KIOSKO.NET, it does not.
Can you download the correct file from kiosko.net?
Yes, see my screenshot -> URLStatus = downloaded and I see it in my desktop.
I downloaded it without problems!

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Tue Feb 01, 2022 6:37 pm
by Fermin
It's true, I'm sorry, I noticed it at first but then I lost track of it... but then I don't understand what's going on. I'm starting to think I've been banned ( :lol: ). Anyway, I'm going to keep investigating to see if I can find the error.
Thank you very much for your time and attention, Klaus.

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Tue Feb 01, 2022 6:43 pm
by Klaus
What did the -> tStatus parameter report you?

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Tue Feb 01, 2022 7:58 pm
by Fermin
I had indicated it in the post where I put my version of your code but I think it was not very obvious because it was as a comment at the end of two lines.

With the website kiosko.net, tStatus = "error".

With the web lasportadas.es, tStatus = "downloaded".

The strangest thing is that I used the same application for most of the first half of 2021 and I downloaded a lot of covers without any problem. And yesterday, when I used the application again, it downloaded the files but with no content (0 bytes).

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Fri Feb 04, 2022 8:48 am
by Fermin
It works correctly in MacOS 12.1 (Monterey).

Re: Could it be that libURLDownloadToFile doesn't work with some website?

Posted: Fri Feb 04, 2022 2:39 pm
by Klaus
Very strange!? :shock: