How to load page information accurately?

Hello everyone

There is currently a project that needs to be load
Lottery number website
There is a five-minute interval between each draw

Should I load page information every second?
Don’t think this is a good way
If load every five minutes, may miss the draw or get the lottery number too late

Is there a better way


Correct me if i’m wrong, but I understand you are doing some kind of web scrapping more than simply loading, i.e parsing the lottery number after using network.request() to get page’s data.
If this is your case then i think the only way is monitoring the web every reasonable ammount of time as you mention, since your app doesn’t have any way to previously know if web content has been updated (unless this web offers a public API for you to interact with).
I’d suggest you checked if there’s some kind of plain file (json, xml) hosted along the index file with lighter content than a whole html page, to allow faster requests.

Thank you for your suggestion

How to check if there’s some kind of plain file (json, xml)?

Thank you

Hi. First, i won’t recommend your app to depend on an external web. It wouldn’t be scalable, and it wouldn’t support that many users since each one’s client would be requesting this web. If you decide to move on in this strategy, then what you could do is research this web’s source code and understand how is this generating and displaying the lottery number in order to take an appropiate action.

On the other hand, you could use nmap to scan directories and files that are being used.

To sum up, my recommendation is: don’t depend on web scrapping for a normal app’s operation (you could use it if it’s a private app for personal use, one-time operations, learning/didactical purposes, etc). Make sure there isn’t already an API that does what you are looking for, before everything. If you decide to do it this way anyways, learn as much as you can about how your target web is doing things. Good luck.

1 Like

Thank you for your professional advice

Let me have a research direction