need to add speechtotext lib
This commit is contained in:
@@ -82,3 +82,8 @@ adb -s B2NGAA8861320589 shell am start -n com.android.chrome/com.google.android.
|
|||||||
adb -s e08f0a85 shell pm clear com.android.chrome
|
adb -s e08f0a85 shell pm clear com.android.chrome
|
||||||
adb -s e08f0a85 shell am set-debug-app --persistent com.android.chrome
|
adb -s e08f0a85 shell am set-debug-app --persistent com.android.chrome
|
||||||
adb -s e08f0a85 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
adb -s e08f0a85 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|
||||||
|
#xiao mi
|
||||||
|
adb -s 192.168.1.24:42397 shell pm clear com.android.chrome
|
||||||
|
adb -s 192.168.1.24:42397 shell am set-debug-app --persistent com.android.chrome
|
||||||
|
adb -s 192.168.1.24:42397 shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
"electron-squirrel-startup": "^1.0.0",
|
"electron-squirrel-startup": "^1.0.0",
|
||||||
"mongodb": "^4.9.1",
|
"mongodb": "^4.9.1",
|
||||||
"mongoose": "^6.5.4",
|
"mongoose": "^6.5.4",
|
||||||
|
"node-wget": "^0.4.3",
|
||||||
"node-xlsx": "^0.21.0",
|
"node-xlsx": "^0.21.0",
|
||||||
"playwright": "1.23.0",
|
"playwright": "1.23.0",
|
||||||
"read-ini-file": "^3.0.1",
|
"read-ini-file": "^3.0.1",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const PublishType = require("../models/PublishType");
|
|||||||
const {
|
const {
|
||||||
shell
|
shell
|
||||||
} = require('electron')
|
} = require('electron')
|
||||||
|
const GeoCaptchaSolver = require("./GeoCaptchaSolver");
|
||||||
// const RDV_URL = "http://192.168.0.44:8000/test_appointment.html"
|
// const RDV_URL = "http://192.168.0.44:8000/test_appointment.html"
|
||||||
const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
|
const RDV_URL = "https://rendezvousparis.hermes.com/client/register";
|
||||||
BLANK_URL = "about:blank"
|
BLANK_URL = "about:blank"
|
||||||
@@ -114,8 +115,6 @@ class CommandorPage {
|
|||||||
async chooseCountry(page) {
|
async chooseCountry(page) {
|
||||||
if (!page.isClosed()) {
|
if (!page.isClosed()) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
await page.locator(COUNTRY_ID).focus();
|
await page.locator(COUNTRY_ID).focus();
|
||||||
await delay(getRandomWaitTime())
|
await delay(getRandomWaitTime())
|
||||||
await page.click(COUNTRY_ID);
|
await page.click(COUNTRY_ID);
|
||||||
@@ -126,7 +125,6 @@ class CommandorPage {
|
|||||||
log(e);
|
log(e);
|
||||||
this.isTerminated = true;
|
this.isTerminated = true;
|
||||||
}
|
}
|
||||||
// await page.click(COUNTRY_ID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +293,6 @@ class CommandorPage {
|
|||||||
try {
|
try {
|
||||||
let content = await currentPage.content();
|
let content = await currentPage.content();
|
||||||
let captcha_url = "geo.captcha-delivery.com/captcha";
|
let captcha_url = "geo.captcha-delivery.com/captcha";
|
||||||
|
|
||||||
if (content.toString().includes(captcha_url)) {
|
if (content.toString().includes(captcha_url)) {
|
||||||
await this.checkAudioBtn();
|
await this.checkAudioBtn();
|
||||||
for (let i = 0; i < 15; i++) {
|
for (let i = 0; i < 15; i++) {
|
||||||
@@ -327,7 +324,9 @@ class CommandorPage {
|
|||||||
let audioBtn = await this.page.frameLocator("iframe").locator("#captcha__audio__button");
|
let audioBtn = await this.page.frameLocator("iframe").locator("#captcha__audio__button");
|
||||||
if (audioBtn) {
|
if (audioBtn) {
|
||||||
log("audioBtn found")
|
log("audioBtn found")
|
||||||
// audioBtn.click()
|
audioBtn.click()
|
||||||
|
let captchSolver = new GeoCaptchaSolver(this.page)
|
||||||
|
captchSolver.solve()
|
||||||
} else {
|
} else {
|
||||||
log("audioBtn not found")
|
log("audioBtn not found")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
const PLAY_AUDIO_BTN_ID = ".audio-captcha-play-button"
|
||||||
|
const wget = require('node-wget');
|
||||||
|
const crypto = require('crypto');
|
||||||
|
const homedir = require('os').homedir();
|
||||||
|
const dest_dir = homedir + "/wavs/"
|
||||||
|
// iframe.query_selector('.audio-captcha-track').inner_html()
|
||||||
|
const AUDIO_CAPTCHA_TRACK = ".audio-captcha-track";
|
||||||
|
const CAPTCHA_CONTAINER = "#captcha-container";
|
||||||
|
const WAV_URL_REGEX = "https:.+.wav";
|
||||||
|
const re = new RegExp(WAV_URL_REGEX);
|
||||||
|
|
||||||
|
function delay(delayInMs) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(2);
|
||||||
|
}, delayInMs);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class GeoCaptchaSolver {
|
||||||
|
constructor(page) {
|
||||||
|
this.page = page
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async solve() {
|
||||||
|
console.log("solve() called.")
|
||||||
|
console.log("play audio")
|
||||||
|
let iframeHandler = await this.page.frameLocator("body > iframe");
|
||||||
|
let playAudioBtn = await iframeHandler.locator(PLAY_AUDIO_BTN_ID);
|
||||||
|
playAudioBtn.click();
|
||||||
|
await delay(5000);
|
||||||
|
// let captcha_track = await iframeHandler.locator(AUDIO_CAPTCHA_TRACK);
|
||||||
|
// const handle = await this.page.frameLocator("iframe");
|
||||||
|
// const contentFrame = await handle.contentFrame();
|
||||||
|
// console.log(contentFrame)
|
||||||
|
let captcha_container = await iframeHandler.locator(CAPTCHA_CONTAINER)
|
||||||
|
// let result = await iframeHandler.evaluate(() => {
|
||||||
|
// document.getElementsByClassName(AUDIO_CAPTCHA_TRACK)
|
||||||
|
// })
|
||||||
|
let html = await captcha_container.innerHTML()
|
||||||
|
console.log("audio_tag: " + html);
|
||||||
|
// find wav from html
|
||||||
|
this.findWavFile(html)
|
||||||
|
}
|
||||||
|
|
||||||
|
findWavFile(html) {
|
||||||
|
let result = re.exec(html);
|
||||||
|
if (result) {
|
||||||
|
let audioUrl = result[0]
|
||||||
|
let fileName = crypto.randomUUID() + ".wav"
|
||||||
|
wget({url: audioUrl, dest: dest_dir + fileName}, function (error, response, body) {
|
||||||
|
if (error) {
|
||||||
|
console.log('--- error:');
|
||||||
|
console.log(error); // error encountered
|
||||||
|
} else {
|
||||||
|
console.log('download the file successfully');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = GeoCaptchaSolver
|
||||||
Reference in New Issue
Block a user