Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 83d389e061 |
@@ -8,6 +8,7 @@ const OCRResult = {
|
|||||||
SLIDING_CAPTCHA_LOADING: Symbol("SLIDING_CAPTCHA_LOADING"),
|
SLIDING_CAPTCHA_LOADING: Symbol("SLIDING_CAPTCHA_LOADING"),
|
||||||
SLIDING_CAPTCHA_REFRESH: Symbol("SLIDING_CAPTCHA_REFRESH"),
|
SLIDING_CAPTCHA_REFRESH: Symbol("SLIDING_CAPTCHA_REFRESH"),
|
||||||
FILL_FIELD: Symbol("FILL_FIELD"),
|
FILL_FIELD: Symbol("FILL_FIELD"),
|
||||||
|
FILL_FIELD_EN: Symbol("FILL_FIELD_EN"),
|
||||||
NEED_TO_CLICK_LATE_BTN: Symbol("NEED_TO_CLICK_LATE_BTN"),
|
NEED_TO_CLICK_LATE_BTN: Symbol("NEED_TO_CLICK_LATE_BTN"),
|
||||||
ONLINE_APPOINTMENT: Symbol("Online Appointment"),
|
ONLINE_APPOINTMENT: Symbol("Online Appointment"),
|
||||||
PAGE_OPTIMIZATION: Symbol("PAGE_OPTIMIZATION"),
|
PAGE_OPTIMIZATION: Symbol("PAGE_OPTIMIZATION"),
|
||||||
|
|||||||
@@ -315,7 +315,9 @@ class CommandorPage {
|
|||||||
// await delay(getRandomWaitTime())
|
// await delay(getRandomWaitTime())
|
||||||
// await page.click(COUNTRY_ID);
|
// await page.click(COUNTRY_ID);
|
||||||
// await delay(getRandomWaitTime())
|
// await delay(getRandomWaitTime())
|
||||||
await page.select(COUNTRY_ID, 'FR');
|
await page.evaluate(() => {
|
||||||
|
document.getElementById("phone_country").value = "FR"
|
||||||
|
})
|
||||||
await delay(getRandomWaitTime())
|
await delay(getRandomWaitTime())
|
||||||
this.isCountryChoosen = true;
|
this.isCountryChoosen = true;
|
||||||
}
|
}
|
||||||
@@ -548,7 +550,7 @@ class CommandorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async fillFields(page) {
|
async fillFields(page, checkResult) {
|
||||||
logWithDevice("fillFields called for contact: " + this.contact.mail, this.device)
|
logWithDevice("fillFields called for contact: " + this.contact.mail, this.device)
|
||||||
logWithDevice("this.isFillingFields: " + this.isFillingFields, this.device);
|
logWithDevice("this.isFillingFields: " + this.isFillingFields, this.device);
|
||||||
logWithDevice("this.isTerminated: " + this.isTerminated, this.device);
|
logWithDevice("this.isTerminated: " + this.isTerminated, this.device);
|
||||||
@@ -556,7 +558,9 @@ class CommandorPage {
|
|||||||
this.isFillingFields = true;
|
this.isFillingFields = true;
|
||||||
await this.chooseStore(page);
|
await this.chooseStore(page);
|
||||||
await this.inputName(page);
|
await this.inputName(page);
|
||||||
// await this.chooseCountry(page);
|
// if (checkResult === OCRResult.FILL_FIELD_EN) {
|
||||||
|
await this.chooseCountry(page);
|
||||||
|
// }
|
||||||
await this.inputPhoneNumber(page)
|
await this.inputPhoneNumber(page)
|
||||||
await this.fillEmail(page)
|
await this.fillEmail(page)
|
||||||
await this.inputPassportId(page)
|
await this.inputPassportId(page)
|
||||||
@@ -907,6 +911,7 @@ class CommandorPage {
|
|||||||
await this.connect_to_browser(checkResult)
|
await this.connect_to_browser(checkResult)
|
||||||
break;
|
break;
|
||||||
case OCRResult.FILL_FIELD:
|
case OCRResult.FILL_FIELD:
|
||||||
|
case OCRResult.FILL_FIELD_EN:
|
||||||
logWithDevice("FILL_FIELD", this.device)
|
logWithDevice("FILL_FIELD", this.device)
|
||||||
if (this.browser === undefined || !this.browser.isConnected()) {
|
if (this.browser === undefined || !this.browser.isConnected()) {
|
||||||
logWithDevice("trying to connect to browser", this.device)
|
logWithDevice("trying to connect to browser", this.device)
|
||||||
@@ -935,42 +940,13 @@ class CommandorPage {
|
|||||||
logWithDevice("this.page.bringToFront();", this.device)
|
logWithDevice("this.page.bringToFront();", this.device)
|
||||||
// await this.sendCookiesToQueue();
|
// await this.sendCookiesToQueue();
|
||||||
await this.page.bringToFront();
|
await this.page.bringToFront();
|
||||||
await this.fillFields(this.page)
|
await this.fillFields(this.page, checkResult)
|
||||||
await delay(2 * 1000);
|
await delay(2 * 1000);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
await this.resetBrowser()
|
await this.resetBrowser()
|
||||||
// this.isTerminated = true;
|
// this.isTerminated = true;
|
||||||
}
|
}
|
||||||
// try {
|
|
||||||
// for (const currentPage of pages) {
|
|
||||||
// if (currentPage.url() === RDV_URL) {
|
|
||||||
// logWithDevice("get content", this.device)
|
|
||||||
// let pageContent = await currentPage.content()
|
|
||||||
// logWithDevice("content:" + pageContent, this.device)
|
|
||||||
// if (!pageContent.includes("geo.captcha-delivery.com")) {
|
|
||||||
// this.page = currentPage;
|
|
||||||
// break
|
|
||||||
// } else {
|
|
||||||
// try {
|
|
||||||
// await currentPage.close()
|
|
||||||
// } catch (e) {
|
|
||||||
// console.log(e)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// try {
|
|
||||||
// await currentPage.close()
|
|
||||||
// } catch (e) {
|
|
||||||
// console.log(e)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// this.isTerminated = true;
|
|
||||||
// console.log(e)
|
|
||||||
// }
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
this.isTerminated = true
|
this.isTerminated = true
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ const BRAVE_VPN_SKIP = "Pare-feu + VPN Brave"
|
|||||||
const MESSAGE_URL_VALIDATION_FR = "Vous recevrez un email de validation"
|
const MESSAGE_URL_VALIDATION_FR = "Vous recevrez un email de validation"
|
||||||
const MESSAGE_URL_VALIDATION_FR_2 = "Merci de votre intérêt pour notre Maison"
|
const MESSAGE_URL_VALIDATION_FR_2 = "Merci de votre intérêt pour notre Maison"
|
||||||
const SSL_CERT_ERROR = " Votre connexion n'est pas privée"
|
const SSL_CERT_ERROR = " Votre connexion n'est pas privée"
|
||||||
const MESSAGE_URL_VALIDATION_EN = "Please click on the link we sent by email"
|
const MESSAGE_URL_VALIDATION_EN = "You will receive an email to validate"
|
||||||
const WRONG_PHONE_NUMBER = "Veuillez renseigner vote numéro de téléphone"
|
const WRONG_PHONE_NUMBER = "Veuillez renseigner vote numéro de téléphone"
|
||||||
const CHOOSE_POSITION_GOOGLE_FR = " Choisir la position pour les résultats de recherche"
|
const CHOOSE_POSITION_GOOGLE_FR = " Choisir la position pour les résultats de recherche"
|
||||||
const CAPTCHA_ERROR_MESSAGE = "Error verifying captcha, please try again"
|
const CAPTCHA_ERROR_MESSAGE = "Error verifying captcha, please try again"
|
||||||
const CAPTCHA_ERROR_MESSAGE_FR = "La vérification du captcha a échoué"
|
const CAPTCHA_ERROR_MESSAGE_FR = "La vérification du captcha a échoué"
|
||||||
const BLOCKED_MSG_EN = "have been blocked"
|
const BLOCKED_MSG_EN = "has been blocked"
|
||||||
const BLOCKED_MSG_FR = "avez été bloqué"
|
const BLOCKED_MSG_FR = "avez été bloqué"
|
||||||
const BLOCKED_MSG_FR_3 = "a été bloqué"
|
const BLOCKED_MSG_FR_3 = "a été bloqué"
|
||||||
const BLOCKED_MSG_FR_2 = "Pourquoi ce blocage"
|
const BLOCKED_MSG_FR_2 = "Pourquoi ce blocage"
|
||||||
@@ -34,8 +34,8 @@ const ERR_CACHE_MISS_2 = "ERR_CACHE-MISS"
|
|||||||
const ERR_CACHE_MISS_3 = "appuyer sur le bouton d'actualisation"
|
const ERR_CACHE_MISS_3 = "appuyer sur le bouton d'actualisation"
|
||||||
const ERR_CACHE_MISS_4 = "renvoyer les données"
|
const ERR_CACHE_MISS_4 = "renvoyer les données"
|
||||||
const ERR_EMPTY_RESPONSE = "ERR_EMPTY_RESPONSE"
|
const ERR_EMPTY_RESPONSE = "ERR_EMPTY_RESPONSE"
|
||||||
const ERR_SSL_PROTOCOL = "SSL_PROTOCOL_ERROR"
|
|
||||||
const SLIDING_CAPTCHA_FR = "Pourquoi cette vérification"
|
const SLIDING_CAPTCHA_FR = "Pourquoi cette vérification"
|
||||||
|
const SLIDING_CAPTCHA_EN = "Slide right to complete the puzzle"
|
||||||
const SLIDING_CAPTCHA_LOADING_FR = "Chargement."
|
const SLIDING_CAPTCHA_LOADING_FR = "Chargement."
|
||||||
const SLIDING_CAPTCHA_FR_2 = "Glissez vers la droite pour"
|
const SLIDING_CAPTCHA_FR_2 = "Glissez vers la droite pour"
|
||||||
const SLIDING_CAPTCHA_FR_3 = "la droite pour completer le puzzle"
|
const SLIDING_CAPTCHA_FR_3 = "la droite pour completer le puzzle"
|
||||||
@@ -43,9 +43,11 @@ const SLIDING_CAPTCHA_FR_4 = " s'assure qu'on s'adresse bien"
|
|||||||
const SLIDING_CAPTCHA_FR_5 = "On s'assure que c'est"
|
const SLIDING_CAPTCHA_FR_5 = "On s'assure que c'est"
|
||||||
const SLIDING_CAPTCHA_FR_6 = "s'assure que cest bien vous"
|
const SLIDING_CAPTCHA_FR_6 = "s'assure que cest bien vous"
|
||||||
const MESSAGE_FILL_FIELD_FR = "Demande de rendez-vous pour"
|
const MESSAGE_FILL_FIELD_FR = "Demande de rendez-vous pour"
|
||||||
|
const MESSAGE_FILL_FIELD_EN = "Appointment request for"
|
||||||
const MESSAGE_FILL_FIELD_FR_2 = "des champs de données doivent étre complétés"
|
const MESSAGE_FILL_FIELD_FR_2 = "des champs de données doivent étre complétés"
|
||||||
const MESSAGE_FILL_FIELD_FR_3 = "Sans préféré"
|
const MESSAGE_FILL_FIELD_FR_3 = "Sans préféré"
|
||||||
const MESSAGE_FILL_FIELD_FR_4 = "Magasin préféré"
|
const MESSAGE_FILL_FIELD_FR_4 = "Magasin préféré"
|
||||||
|
const MESSAGE_FILL_FIELD_EN_4 = "Favorite store"
|
||||||
const MESSAGE_FILL_FIELD_FR_5 = "email vous sera envoyé pour vous"
|
const MESSAGE_FILL_FIELD_FR_5 = "email vous sera envoyé pour vous"
|
||||||
const MESSAGE_FILL_FIELD_FR_6 = "Prénom* Téléphone*"
|
const MESSAGE_FILL_FIELD_FR_6 = "Prénom* Téléphone*"
|
||||||
const WELCOME_MESSAGE_FR = "Bienvenue dans Chrome"
|
const WELCOME_MESSAGE_FR = "Bienvenue dans Chrome"
|
||||||
@@ -73,11 +75,14 @@ const BRAVE_SKIP_PUB_5 = "aucune traceur"
|
|||||||
const BRAVE_SKIP_PUB_4 = "aucune publicité"
|
const BRAVE_SKIP_PUB_4 = "aucune publicité"
|
||||||
const BRAVE_SKIP_DEFAULT_PAGE = "confidentialité de Brave"
|
const BRAVE_SKIP_DEFAULT_PAGE = "confidentialité de Brave"
|
||||||
const BRAVE_SKIP_DEFAULT_PAGE_2 = "définissant Brave"
|
const BRAVE_SKIP_DEFAULT_PAGE_2 = "définissant Brave"
|
||||||
|
const BRAVE_SKIP_DEFAULT_PAGE_EN = "With Brave as default"
|
||||||
const BRAVE_SKIP_PRIVACY_PAGE = "Partagez des informations"
|
const BRAVE_SKIP_PRIVACY_PAGE = "Partagez des informations"
|
||||||
|
const BRAVE_SKIP_PRIVACY_PAGE_EN = "make Brave better"
|
||||||
const BRAVE_SKIP_PRIVACY_PAGE_3 = "Partagez de informations"
|
const BRAVE_SKIP_PRIVACY_PAGE_3 = "Partagez de informations"
|
||||||
const BRAVE_SKIP_PRIVACY_PAGE_2 = "Partagez des renseignements"
|
const BRAVE_SKIP_PRIVACY_PAGE_2 = "Partagez des renseignements"
|
||||||
|
|
||||||
const PUSH_NOTIFICATION_1 = "Brave à vous envoyer des notifications"
|
const PUSH_NOTIFICATION_1 = "Brave à vous envoyer des notifications"
|
||||||
|
const PUSH_NOTIFICATION_EN_1 = "Brave to send you notifications"
|
||||||
|
|
||||||
class OCRChecker {
|
class OCRChecker {
|
||||||
|
|
||||||
@@ -103,7 +108,7 @@ class OCRChecker {
|
|||||||
} else if (result.includes(BRAVE_NOTIFICATION)) {
|
} else if (result.includes(BRAVE_NOTIFICATION)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.BRAVE_NOTIFICATION
|
return OCRResult.BRAVE_NOTIFICATION
|
||||||
} else if (result.includes(PUSH_NOTIFICATION_1)) {
|
} else if (result.includes(PUSH_NOTIFICATION_1) || result.includes(PUSH_NOTIFICATION_EN_1)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.BRAVE_PUSH_NOTIFICATION
|
return OCRResult.BRAVE_PUSH_NOTIFICATION
|
||||||
} else if (result.includes(CHOOSE_POSITION_GOOGLE_FR)) {
|
} else if (result.includes(CHOOSE_POSITION_GOOGLE_FR)) {
|
||||||
@@ -118,9 +123,21 @@ class OCRChecker {
|
|||||||
} else if (result.includes(WRONG_PHONE_NUMBER)) {
|
} else if (result.includes(WRONG_PHONE_NUMBER)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.WRONG_PHONE_NUMBER
|
return OCRResult.WRONG_PHONE_NUMBER
|
||||||
} else if (result.includes(MESSAGE_FILL_FIELD_FR) || result.includes(MESSAGE_FILL_FIELD_FR_2) || result.includes(MESSAGE_FILL_FIELD_FR_3) || result.includes(MESSAGE_FILL_FIELD_FR_4) || result.includes(MESSAGE_FILL_FIELD_FR_5) || result.includes(MESSAGE_FILL_FIELD_FR_6)) {
|
} else if (result.includes(MESSAGE_FILL_FIELD_FR)
|
||||||
|
|| result.includes(MESSAGE_FILL_FIELD_FR_2)
|
||||||
|
|| result.includes(MESSAGE_FILL_FIELD_FR_3)
|
||||||
|
|| result.includes(MESSAGE_FILL_FIELD_FR_4)
|
||||||
|
|| result.includes(MESSAGE_FILL_FIELD_EN_4)
|
||||||
|
|| result.includes(MESSAGE_FILL_FIELD_FR_5)
|
||||||
|
|| result.includes(MESSAGE_FILL_FIELD_EN)
|
||||||
|
|| result.includes(MESSAGE_FILL_FIELD_FR_6)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.FILL_FIELD
|
return OCRResult.FILL_FIELD
|
||||||
|
} else if (result.includes(MESSAGE_FILL_FIELD_EN_4)
|
||||||
|
|| result.includes(MESSAGE_FILL_FIELD_EN)
|
||||||
|
) {
|
||||||
|
await this.deleteFile(fileName)
|
||||||
|
return OCRResult.FILL_FIELD_EN
|
||||||
} else if (result.includes(CAPTCHA_ERROR_MESSAGE) || result.includes(CAPTCHA_ERROR_MESSAGE_FR)) {
|
} else if (result.includes(CAPTCHA_ERROR_MESSAGE) || result.includes(CAPTCHA_ERROR_MESSAGE_FR)) {
|
||||||
return OCRResult.RECAPTCHA_ERROR
|
return OCRResult.RECAPTCHA_ERROR
|
||||||
} else if (result.includes(BRAVE_SKIP_PUB) || result.includes(BRAVE_SKIP_PUB_2) || result.includes(BRAVE_SKIP_PUB_3) || result.includes(BRAVE_SKIP_PUB_4) || result.includes(BRAVE_SKIP_PUB_5)) {
|
} else if (result.includes(BRAVE_SKIP_PUB) || result.includes(BRAVE_SKIP_PUB_2) || result.includes(BRAVE_SKIP_PUB_3) || result.includes(BRAVE_SKIP_PUB_4) || result.includes(BRAVE_SKIP_PUB_5)) {
|
||||||
@@ -139,7 +156,10 @@ class OCRChecker {
|
|||||||
} else if (result.includes(BRAVE_NOTIFICATION)) {
|
} else if (result.includes(BRAVE_NOTIFICATION)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.BRAVE_NOTIFICATION
|
return OCRResult.BRAVE_NOTIFICATION
|
||||||
} else if (result.includes(SLIDING_CAPTCHA_FR) || result.includes(SLIDING_CAPTCHA_FR_2) || result.includes(SLIDING_CAPTCHA_FR_3) || result.includes(SLIDING_CAPTCHA_FR_4) || result.includes(SLIDING_CAPTCHA_FR_5) || result.includes(SLIDING_CAPTCHA_FR_6)) {
|
} else if (result.includes(SLIDING_CAPTCHA_FR)
|
||||||
|
|| result.includes(SLIDING_CAPTCHA_EN)
|
||||||
|
|| result.includes(SLIDING_CAPTCHA_FR_2)
|
||||||
|
|| result.includes(SLIDING_CAPTCHA_FR_3) || result.includes(SLIDING_CAPTCHA_FR_4) || result.includes(SLIDING_CAPTCHA_FR_5) || result.includes(SLIDING_CAPTCHA_FR_6)) {
|
||||||
if (result.includes(SLIDING_CAPTCHA_LOADING_FR)) {
|
if (result.includes(SLIDING_CAPTCHA_LOADING_FR)) {
|
||||||
return OCRResult.SLIDING_CAPTCHA_LOADING
|
return OCRResult.SLIDING_CAPTCHA_LOADING
|
||||||
} else {
|
} else {
|
||||||
@@ -181,10 +201,13 @@ class OCRChecker {
|
|||||||
} else if (result.includes(NO_INTERNET_FR) || result.includes(NO_INTERNET_FR_2)) {
|
} else if (result.includes(NO_INTERNET_FR) || result.includes(NO_INTERNET_FR_2)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.NO_INTERNET
|
return OCRResult.NO_INTERNET
|
||||||
} else if (result.includes(BRAVE_SKIP_DEFAULT_PAGE) || result.includes(BRAVE_SKIP_DEFAULT_PAGE_2)) {
|
} else if (result.includes(BRAVE_SKIP_DEFAULT_PAGE) || result.includes(BRAVE_SKIP_DEFAULT_PAGE_EN) || result.includes(BRAVE_SKIP_DEFAULT_PAGE_2)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.BRAVE_SKIP
|
return OCRResult.BRAVE_SKIP
|
||||||
} else if (result.includes(BRAVE_SKIP_PRIVACY_PAGE) || result.includes(BRAVE_SKIP_PRIVACY_PAGE_2) || result.includes(BRAVE_SKIP_PRIVACY_PAGE_3)) {
|
} else if (result.includes(BRAVE_SKIP_PRIVACY_PAGE)
|
||||||
|
|| result.includes(BRAVE_SKIP_PRIVACY_PAGE_2)
|
||||||
|
|| result.includes(BRAVE_SKIP_PRIVACY_PAGE_EN)
|
||||||
|
|| result.includes(BRAVE_SKIP_PRIVACY_PAGE_3)) {
|
||||||
await this.deleteFile(fileName)
|
await this.deleteFile(fileName)
|
||||||
return OCRResult.BRAVE_PRIVACY
|
return OCRResult.BRAVE_PRIVACY
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,6 +2,6 @@ const {startBookWithNumbers} = require('./src/appointment')
|
|||||||
const {homedir} = require("os");
|
const {homedir} = require("os");
|
||||||
homeDir = homedir()
|
homeDir = homedir()
|
||||||
//faubourg, random
|
//faubourg, random
|
||||||
startBookWithNumbers(0, 10000, "random", homeDir + "/Desktop/contact_list_2024-09-11.xlsx", true, false).then((r) => {
|
startBookWithNumbers(0, 10000, "random", homeDir + "/Desktop/contact_list_2024-09-19.xlsx", true, false).then((r) => {
|
||||||
console.log(r)
|
console.log(r)
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user