глянул скрин но вы даже на url не можете зайти загугли бы что значит ошибка 403
Ошибка доступа 403 происходит, когда веб-страница (или другой ресурс), которую вы пытаетесь открыть в веб-браузере, является ресурсом, к которому у вас ограничен доступ. Она называется ошибкой 403 по коду состояния протокола HTTP, который использует веб-сервер для описания ошибки такого рода.
Вас там забанили ? по ип возможно из за частых обращений, юзайте качественые прокси
Если вам не пришло это, то действительно юзайте браузер не ужели вам нужна скорость 100500 в секунду, браузер с потоками вам будет самое то!
помогите розбратса на етом примере как использовать функцию await resolve
-
const Tesseract = require('tesseract.js'); // URL of the image to process const imageUrl = 'https://i.pinimg.com/originals/43/57/06/435706ac8601df85a4312ea95e4f7401.jpg'; // Array to store log messages const logs = []; // Function to add a log message (finishes immediately) function addLog(message) { logs.push(message); } // Function to display all logs (finishes immediately) function displayLogs() { logs.forEach(log => console.log(log)); } // Function to handle the OCR result (called asynchronously) function handleResult(result) { addLog('OCR Process Completed.'); addLog('Extracted Text: ' + result.data.text); displayLogs(); // Display all logs at the end } // Function to perform OCR (asynchronous operation) function performOCR(url) { addLog('Starting OCR process.'); Tesseract.recognize( url, 'eng', { logger: m => addLog(m.status + ' ' + Math.round(m.progress * 100) + '%') } ) .then(handleResult) .catch(error => { addLog('An error occurred during OCR processing.'); addLog(error.toString()); displayLogs(); // Display all logs if an error occurs }); } // Start OCR process (initial call finishes immediately, but OCR is async) performOCR(imageUrl); -
const Tesseract = require('tesseract.js'); // URL of the image to process const imageUrl = [[FILE_JPG]]; // Array to store log messages const logs = []; // Function to add a log message function addLog(message) { logs.push(message); } // Function to display all logs function displayLogs() { logs.forEach(log => console.log(log)); } await (new Promise((resolve, reject) => { // Function to perform OCR (asynchronous operation) async function performOCR(url) { addLog('Starting OCR process.'); try { const result = await Tesseract.recognize(url, 'eng', { logger: m => addLog(m.status + ' ' + Math.round(m.progress * 100) + '%') }); // Handle OCR result addLog('OCR Process Completed.'); addLog('Extracted Text: ' + result.data.text); } catch (error) { // Handle OCR error addLog('An error occurred during OCR processing.'); addLog(error.toString()); } resolve() displayLogs(); // Display all logs at the end } // Call performOCR function asynchronously performOCR(imageUrl); }));