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

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

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

Post by Fermin » Tue Feb 01, 2022 9:46 am

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.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Tue Feb 01, 2022 2:54 pm

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
Attachments
Bildschirmfoto 2022-02-01 um 14.52.48.jpg

Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

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

Post by Fermin » Tue Feb 01, 2022 5:42 pm

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

Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

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

Post by Fermin » Tue Feb 01, 2022 5:55 pm

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.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Tue Feb 01, 2022 6:11 pm

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!

Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

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

Post by Fermin » Tue Feb 01, 2022 6:37 pm

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.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Tue Feb 01, 2022 6:43 pm

What did the -> tStatus parameter report you?

Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

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

Post by Fermin » Tue Feb 01, 2022 7:58 pm

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).

Fermin
Posts: 142
Joined: Fri Jun 05, 2015 10:44 pm

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

Post by Fermin » Fri Feb 04, 2022 8:48 am

It works correctly in MacOS 12.1 (Monterey).

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Fri Feb 04, 2022 2:39 pm

Very strange!? :shock:

Post Reply

Return to “Talking LiveCode”