mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
23 lines
470 B
JavaScript
23 lines
470 B
JavaScript
import { recognize } from 'node-tesseract-ocr';
|
|
import { serialize } from 'bson';
|
|
|
|
export default async function runOCR(client, eventData) {
|
|
const config = {
|
|
lang: 'eng',
|
|
oem: 3,
|
|
psm: 3,
|
|
};
|
|
|
|
const ocrText = await recognize(eventData.url, config);
|
|
|
|
const jsonData = {
|
|
op: 6,
|
|
id: eventData.id,
|
|
ocrText
|
|
};
|
|
|
|
const bsonData = serialize(jsonData);
|
|
client.write(bsonData);
|
|
|
|
return;
|
|
} |