1.1.0 • Published 3 years ago

textscrapper v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

textscrapper

npm module for extracting text from any window active on your computer

Peer Dependencies

  • Axios, jimp npm install axios jimp

For Mac and Linux:

  • active-win

    npm install active-win

For Windows:

  • screenshot-desktop
  • win32-api
    	```npm install screenshot-desktop win32-api```

Linux users may need to install ImageMagicK:
sudo apt install imagemagick

Install

npm install textscrapper

Quickstart

Before you begin 1. Select or create a Cloud Platform project. 2. Enable billing for your project. 3. Enable the Google Cloud Vision API. 4. Set up authentication with a service account so you can access the API from your local workstation.

Usage

const textscrapper = require("textscrapper");

(async () => {
    // api key of google cloud project
    textscrapper.setApiKey(API_KEY);

    // optional, sets emrconfigs to identify which window to detect or not
    // if not set, then it will detect all active windows
    textscrapper.setConfig({
        config: [
        {
            active: true,
            displayName: "Google Chrome",
            windowWildCard: "Google",
            emrKey: "GOOGLE",
            cropPercentages: { top: 20, right: 10, left: 10, bottom: 0 }
        },
        {
            active: true,
            displayName: "Visual Studio Code",
            windowWildCard: "Code",
            emrKey: "VSCODE",
            cropPercentages: { top: 10, right: 70, left: 5, bottom: 50 }
        }
    ]});

    // limit maximum results
    const maxResults = 5;
    try {
        // extract text from active windows
        let texts = await textscrapper.extractText(maxResults);
        console.log(texts);
    } catch (e) {
        console.error(e);
    } 
})();

// Other Methods

// Detect active window on your computer, returns window object.
const window = textscrapper.detectWindow();

// Get base64image of active window
const base64image = await textscrapper.getBase64Image(window);

// getText from base64image, {maxResults}: limit maximum results
const texts = await textscrapper.extractTextFromImage(base64Image, maxResults);

License

MIT

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago