mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-25 20:21:02 +00:00
Add OCR, add configuration
This commit is contained in:
23
server/events/ocr.js
Normal file
23
server/events/ocr.js
Normal file
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user