From 1b0d8c9f7e812b7afef1bde5d7aea1e85720ecee Mon Sep 17 00:00:00 2001 From: PAN Lei Date: Fri, 9 Dec 2022 14:19:00 +0100 Subject: [PATCH] enriche search text --- src/workers/CommandorPage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index 48facfc..208b986 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -36,6 +36,7 @@ const CAPTCHA_ERROR_MESSAGE = "Error verifying captcha, please try again" const CAPTCHA_ERROR_MESSAGE_FR = "La vérification du captcha a échoué" REGEX_RDV_URL = "https:\/\/rendezvousparis\.hermes\.com\/client\/register\/[A-Z0-9]+" const DEFAULT_STORE = 'faubourg'; +const searchTexts = ['hermes+rdv', 'hermes+rendezvous', 'hermes+appointment', 'appointment+hermes', 'online+appointment+hermes', 'hermes+online+appointment'] function delay(delayInMs) { return new Promise(resolve => { @@ -93,7 +94,8 @@ class CommandorPage { this.onResponse(response) }) try { - await this.page.goto("https://www.google.com/search?q=hemes+appointment", {timeout: 90 * 1000}); + const item = searchTexts[Math.floor(Math.random() * searchTexts.length)]; + await this.page.goto("https://www.google.com/search?q=" + item, {timeout: 90 * 1000}); // await this.page.goto(RDV_URL, {timeout: 90 * 1000}); } catch (e) { log(e)