delete wav file after request successfully

This commit is contained in:
2022-09-28 09:22:34 +02:00
parent 025787e660
commit f479514a99
+10 -5
View File
@@ -38,16 +38,22 @@ async function sendRequest(fileName, callback) {
if (response.status === 200) { if (response.status === 200) {
let result = response.data; let result = response.data;
console.log(result); console.log(result);
callback(result) callback(result);
console.log("will delete wav file: " + fileName);
await fs.unlink(fileName, (err) => {
if (err) throw err;
console.log(fileName + ' was deleted');
})
} else { } else {
console.log("error") console.log("error");
callback([]) callback([]);
console.log("will delete wav file: " + fileName);
} }
} }
class GeoCaptchaSolver { class GeoCaptchaSolver {
constructor(page) { constructor(page) {
this.page = page this.page = page;
} }
@@ -61,7 +67,6 @@ class GeoCaptchaSolver {
let captcha_container = await iframeHandler.locator(CAPTCHA_CONTAINER) let captcha_container = await iframeHandler.locator(CAPTCHA_CONTAINER)
let html = await captcha_container.innerHTML() let html = await captcha_container.innerHTML()
console.log("audio_tag: " + html); console.log("audio_tag: " + html);
let fieldInputs = await iframeHandler.locator("#captcha__audio > div.audio-captcha-input-container > input:nth-child(1)")
// find wav from html // find wav from html
await this.findTextFromWavFile(html, async (number_list) => { await this.findTextFromWavFile(html, async (number_list) => {
for (let i = 1; i <= number_list.length; i++) { for (let i = 1; i <= number_list.length; i++) {