8000 GitHub - gazhay/ocrtweetbot: A bot that helps make twitter more accessible.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gazhay/ocrtweetbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OcrTweetBot

A simple bot which attempts to OCR images and tweet the resulting text as a thread.

Dependencies

tweepy3.9 python-dotenv ocrspace

ocrspace is no longer an external dependency as the latest version wasn't available on pypy. It is duplicated inside this project with credit to https://github.com/ErikBoesen/ocrspace

Requirements

Twitter account & developer account ocrspace free (or pro) API key

Create a file called .env in the working directory of the script with the following variables filled out

CONSUMER_KEY='<TWITTER KEY>'
CONSUMER_SECRET='<TWITTER KEY>'
ACCESS_TOKEN='<TWITTER KEY>'
ACCESS_TOKEN_SECRET='<TWITTER KEY>'
OCR_KEY='<OCRSPACE KEY>'


TWITTER_SN="@<TWITTER SCREEN NAME>"
TWITTER_MW="<MAGIC PHRASE>"

MAGIC PHRASE is something like "ocrplz".

Then run the script at whatever intervals the APIs will allow you.

ocrTweet version of the bot

The bot looks through its mentions from the last seen mention, if it finds the magic keyword it will attempt to find images, ocr them and send replies to whoever requested the bot to work with the text it finds.

ocrStream version of the bot

This bot is an "always-on" version of the bot. It works in exactly the same way as the single run bot, but makes use of Tweepy stream features. By default it registers both TWITTER_SN and TWITTER_MW as filter conditions to grab tweets.

I would imagine this version will hit rate limits all over the place - especially on free plans.

Disclaimers

This is alpha quality work. It does enough to work in the narrow cases it has been tested with. (@theousherwood tweets and one from the poke).

It would be trivial to trip it up and it has little error handling or reporting.

I also don't have the resources to host and run this beyond the free tier of API access to both twitter and OCRSpace. These will get used up fairly quickly, that's why it is here on github.

It would be good if twitter would go beyond their current model of opt-in image descriptions. Making them mandatory would be great. Automatically OCRing images like this bot aims to do would also be great, both well within the resources of the company.

Out in the wild

It is currently running on the account @ocrbot1 on twitter. With the great help of pythonanywhere @pythonanywhere

About

A bot that helps make twitter more accessible.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0