jvolker / miq-nz-booking-tools

Tools to help booking a spot in New Zealand Managed Isolation and Quarantine. Automatically refreshes, checks and fills forms in the website to find and book the rare spots.
MIT License
83 stars 35 forks source link

Log out after 600 refresh #123

Open Helinate opened 3 years ago

Helinate commented 3 years ago

Hello

I get logged out after 600 refresh, I have read other posts but mine seems to happen on the number every time. Any ideas? Thanks

HKG2301 commented 3 years ago

You beat me to it, Helinate! I have also been logged out several times now, on the 600th refresh.

I'm going to reduce the refresh rate to every 10 or 15 secs for now, just for duration / coverage. Otherwise I'm scared I'm going to miss out on a large dump of December dates, due out soon...

Anwere commented 3 years ago

Yep me three, just had it happen now

mouarg commented 3 years ago

Yes I can confirm this as well :S

mquinn023 commented 3 years ago

The process is bombing out consistently now after 600 refreshes. Terminal output is below:

Welcome to the MIQ Booking Assistance! A new browser window should appear. Please navigate to "Secure your allocation" page. Found "Secure your allocation" page! Wait for beep sound, confirm the date selected is what you want, then do the reCAPTCHA and click 'next' to continue booking. Checked MIQ: 600 times, last checked at: 07/08/2021, 22:00:46 /miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:509 const timeoutError = new Errors_js_1.TimeoutError(waiting for ${options.title} failed: timeout ${options.timeout}ms exceeded);

TimeoutError: waiting for selector #accommodation failed: timeout 30000ms exceeded at new WaitTask (miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:509:34) at DOMWorld.waitForSelectorInPage (/miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:420:26) at Object.internalHandler.waitFor (/miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/node_modules/puppeteer/lib/cjs/puppeteer/common/QueryHandler.js:31:77) at DOMWorld.waitForSelector (/miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:313:29) at Frame.waitForSelector (/miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:841:51) at Page.waitForSelector (/miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2252:33) at prepareAndCheckPage (/miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/miq-assistance.js:119:16) at prepareAndCheckPage (/miq-nz-booking-tools-master-9/MIQ-Booking-Assistance/miq-assistance.js:138:15) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5)

cummins070 commented 3 years ago

Also having the same issue. Wonder if there would be a way that the program could reset it's self after 590 refreshes or something and just start form 0?

sebjamesfd commented 3 years ago

I was just watching this happen on the 600th refresh. As far as I can tell it is actually the MIQ website that is ending the session here not this booking tool.

mquinn023 commented 3 years ago

The only workaround I can see at the moment as mentioned above is to increase the timeout value from 1000 in miq-assistance.js:

await page.waitForTimeout(secondsTillRefresh * 1000);

1500 just ran for around 4-5 hours with 1527 refreshes.

Ghostfinder commented 3 years ago

Hi everyone, having this same issue. What effect does increasing the timeout value have? Does it increase the refresh rate set in the main part of the tool?

shoey123 commented 3 years ago

Hi there, first time poster on github/ only just registered with sole purpose to download this script and run it, to try and get a spot in NZ MIQ. What a ball-ache. Thank you to everyone who have been helpful in comments and above to the authors of the script.

I just downloaded and was getting booted after 600 refreshes.

I changed the:

<<await page.waitForTimeout(secondsTillRefresh * 1000);>>

to 1500 as suggested by @mquinn023 to try and avoid any issues. So far so good.

In the miq-assistance.js file, on line 16, it says: "But if you like you can prefill credentials instead. To do this you have to change the option to "login", run the script and login. Afterwards you need to switch back to "login-done" and restart the script"

I followed these instructions, but after logging out and logging back in, I still had to enter in my login credentials. I am assuming this part does not work/ apply anymore as on the login screen on the MIQ page you have to the recaptcha and select the box that "you are not a robot".

Any advice is greatly appreciated.

Thank you.


Update - I got to 424 refreshes and then I was logged out. I am not sure if this was because I was temporarily blocked from too many refreshes (I did not get a warning message etc stating that), OR was it due to inactivity. If it was due to inactivity, is there way to edit the code such that this is avoided?

GaryBartlett commented 3 years ago

The login feature automates the population of the login fields just fine. Just add your email and password, set it to login (rather than login-done) and leave it like that.

shoey123 commented 3 years ago

Thanks @GaryBartlett, appreciate it!

jvolker commented 3 years ago

await page.waitForTimeout(secondsTillRefresh * 1000);

1500 just ran for around 4-5 hours with 1527 refreshes.

You don't need to change the code for that. Just change page refresh time in the user interface to 7.5 (default is 5 multiplied by 1.5)

image

What effect does increasing the timeout value have? Does it increase the refresh rate set in the main part of the tool?

Yes, it's the same.