Coder Social home page Coder Social logo

fakemenot's Introduction

fakemenot

Python CLI app to detect if a screenshot of a tweet is genuine. Work in Progress.

Requriements

  • tesseract
  • tesseract-data-eng

Setting Up

  • Install tesseract and tesseract-data-eng packages.

    • Ubuntu (and other debian based) : sudo apt-get install tesseract-ocr tesseract-ocr-eng
    • Fedora : sudo dnf install tessearct
    • Arch Linux: sudo pacman -S tesseract tesseract-data-eng
  • Run python setup.py install to install requirements. Install script is still a work in progress.

  • [ ! -f ~/.fakemenot.config ] && cp fakemenot/twitter.config ~/.fakemenot.config

  • Go to https://apps.twitter.com/app/new and put your consumer and API keys in ~/.fakemenot.config

  • Run fakemenot after installation. Setup will install it in your path.

Limitations

  • Since it does OCR on the image, detection rate will vary on the quality of the screenshot.
  • Only support desktop screenshots now. Universal support coming soon! :)

Arguments

  • --image/-i

Path to the screenshot image of tweet. Only works on Desktop screenshots.

  • --limit/-l

Specify the number of tweets to pull from the detected user. Defaults to 100. Retweets are not pulled and does not affect the limit.

  • --config/-c

Specify an alternate configuration file containing your twitter identification and authentication material. Defaults to ~/.fakemenot.config

Image Samples

Tweet by @mattdm:

Output:

fakemenot's People

Contributors

abhinavralhan avatar elahmo avatar kuldipkumark avatar omaciel avatar pcn avatar pwnfoo avatar rkrp avatar throwsexception avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fakemenot's Issues

Prettify + Colorize Output

As the title says, it'll be nice to have the output colorized. Please implement a cross-platform solution :)

Error running app

python init.py -i /home/abhinavralhan/Desktop/Selection_031.png
Error 404: ('Not Found: The URI requested is invalid or', 'the resource requested does not exists')


The error given above is a little tough to debug. Please help

Ubuntu setup fail

Running this on Ubuntu 16.04 LTS, as per the given setup. The package is not found.

sudo apt-get install tessearct-ocr tesseract-data-eng
[sudo] password for user:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package tessearct-ocr
E: Unable to locate package tesseract-data-eng

App fails to run

When running the app, this always (at least for me) occurs:

ahmet ๎‚ฐ Desktop ๎‚ฐ fakemenot -i twitter.png Detected handle : @elahmo Traceback (most recent call last): File "/Users/ahmet/anaconda/bin/fakemenot", line 11, in <module> load_entry_point('fakemenot==0.0.3', 'console_scripts', 'fakemenot')() File "build/bdist.macosx-10.9-x86_64/egg/fakemenot/__init__.py", line 190, in main File "build/bdist.macosx-10.9-x86_64/egg/fakemenot/__init__.py", line 115, in _do_ocr_and_lookup ValueError: 'v' is not in list

The issue is at this line.

@SachinKamath can you tell us the reasoning by looking for this V? This is not always suggested by OCR, and a simple fix is to remove this check completely, and I did that in my repo, but wanted to see is there any reason for this.

Handle the twitter configuration file

We recently moved to setup.py based installation and it looks like a thing or two broke.

The file fakemenot/twitter.config needs to be handled now. There are multiple ways to handle this.

  • Ask the user to keep the file in homedir, something like .twitterconfig and read it.
  • Pass the configuration file using an argument, say -c.
  • Handle the file during the installation itself.

Add partial matches / various confidence levels

Right now, the app only checks if the confidence level is above a certain percentage. It'd be great to print the confidence level of all the images given and have various levels of confidence.

Error running fakemenot

fakemenot
Traceback (most recent call last):
File "/home/abhinavralhan/miniconda3/bin/fakemenot", line 6, in
from pkg_resources import load_entry_point
File "", line 961, in _find_and_load
File "", line 950, in _find_and_load_unlocked
File "", line 646, in _load_unlocked
File "", line 616, in _load_backward_compatible
File "/home/abhinavralhan/miniconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/init.py", line 2985, in
File "/home/abhinavralhan/miniconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/init.py", line 2971, in _call_aside
File "/home/abhinavralhan/miniconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/init.py", line 2998, in _initialize_master_working_set
File "/home/abhinavralhan/miniconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/init.py", line 660, in _build_master
File "/home/abhinavralhan/miniconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/init.py", line 968, in require
File "/home/abhinavralhan/miniconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/init.py", line 854, in resolve
pkg_resources.DistributionNotFound: The 'Pillow' distribution was not found and is required by pytesseract

"OSError : No such file or directory" when running fakemenot

I tried to run fakemenot but the error occured

Traceback (most recent call last):
  File "/usr/local/bin/fakemenot", line 11, in <module>
    load_entry_point('fakemenot==0.0.2', 'console_scripts', 'fakemenot')()
  File "build/bdist.linux-x86_64/egg/fakemenot/__init__.py", line 136, in main
  File "build/bdist.linux-x86_64/egg/fakemenot/__init__.py", line 45, in _do_ocr_and_lookup
  File "build/bdist.linux-x86_64/egg/pytesseract/pytesseract.py", line 122, in image_to_string
  File "build/bdist.linux-x86_64/egg/pytesseract/pytesseract.py", line 46, in run_tesseract
  File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

I'm running this on lubuntu. The subprocess.py is existed.

Add more samples on README

It'll be nice to have a graphic representation of what works and what doesn't.

Things to do :

  • Add a sample with a fake tweet.
  • Add a sample with blurry text.

Enhance string matching

The current method is a handmade algorithm which is not very efficient. A Levenshtein Distance based algo will be good to have.

Invalid syntax

I tried to run fakemenot and this problem occured

Traceback (most recent call last):
  File "/usr/local/bin/fakemenot", line 11, in <module>
    load_entry_point('fakemenot==0.0.3', 'console_scripts', 'fakemenot')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/fakemenot-0.0.3-py2.7.egg/fakemenot/__init__.py", line 67
    'consumer_key')..replace(
                    ^
SyntaxError: invalid syntax

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.