Giter VIP home page Giter VIP logo

ocr-scanner-tg-bot's Introduction

Text from Image Scanner Telegram Bot ·

Build Status npm PRs Welcome GitHub license

Simple Telegram Bot to extract text from image based on ocr api

Simple Telegram Bot to extract text from image based on ocr api by Gemchis Elias

Check out The Sample Bot


Installing / Getting started

Go to @botfather and create a new bot. Copy your api token and setwebhook by pasting this link on browser.

· Change XXXXXX with your bot token
· Change url to domain you host the php file.

https://api.telegram.org/botXXXXXX/setWebHook?url=yourdomain.com/bot.php

Code to edit

Just edit 2nd line by changing api key on bot.php api key can be found here https://ocr.space/ocrapi

//Change OCR-KEY to your api key from ocr.space website
            $result = file_get_contents('http://api.ocr.space/parse/imageurl?apikey=<OCR-KEY-XXX>&url='.$id_url);
            $result=json_decode($result, true);
            $str='';
            foreach($result['ParsedResults'] as $pareValue) 
                {
                            $str.= strval($pareValue['ParsedText']);
                }
                if($str!=""){ 
                $re= 
                array(
                'chat_id' => $chatId, 
                'text' => "🔍Scanned Text:\n$str\n\n@horansoftware",
                'disable_web_page_preview' => false,);
                    send("sendMessage", $re);
                }   #end

Change Bot API Token

Don't forget pasting your bot token every where needed in the bot.php

$path = "https://api.telegram.org/bot<Your Bot Token>/";

Code Written by Gemechis Elias

ocr-scanner-tg-bot's People

Contributors

gemechis-elias avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

netsanetamanuel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.