Giter Club home page Giter Club logo

edoardottt / twitterbot Goto Github PK

View Code? Open in Web Editor NEW
39.0 10.0 21.0 437 KB

[NOT WORKING] ๐Ÿค– CLI Twitter Bot. It's made to reach more engagement based on your interests. See https://github.com/edoardottt/twitterbot2

Home Page: https://edoardoottavianelli.it

License: MIT License

Python 100.00%
twitter tweet tweets twitter-bot pydev python3 python selenium webscraping bot python-script bots sql sqlite3 sqlite3-database twitterbot tweets-reached feed retweets keywords

twitterbot's Introduction

twitterBot ๐Ÿค–

VERSION 2 OUT NOW => twitterbot2

โš ๏ธCURRENTLY NOT WORKING DUE TO NEW TWITTER WEBSITEโš ๏ธ

Follow https://twitter.com/edoardottt2

CLI Twitter Bot. It's made to reach more engagement based on your interests.

version python-version win-build-success-badge.svg Codacy Badge

Does it really works? ๐Ÿ“Š

Take a look

general analytics

followers analytics

my insights (from twitterBot)

Get started ๐ŸŽ‰

  • Download this repo and open a terminal inside the main folder

  • Install the required libraries: pip install -r requirements.txt

  • ONLY FOR LINUX

  • To start the bot searching for some keywords:

    python twitterbot.py -u [email protected] -k trend,topics,twitter

  • To start the bot with your feed:

    python twitterbot.py -u [email protected] -m

  • To see your account bot statistics with a chart:

    python twitterbot.py -u [email protected] -s

  • To see info:

    python twitterbot.py -i

  • Help doc.:

    python twitterbot.py -h

  • Follow the followers of an user:

    python twitterbot.py -u [email protected] -f edoardottt2

Description ๐Ÿ”ฆ

It uses selenium, matplotlib, getpass and other famous python libraries.

It tries to login with an email and a password on Twitter. If credentials are correct, It looks into the database if that user logged in yet and so if There is a record with that username id. If there isn't that record, It creates it. If the credentials aren't correct, throws an error.

It captures the followers count in your Home. You can decide if It searches for some keywords as input and It will looks for some tweets searching those words in the search input field. Instead you can crawl the tweets present in your Home Feed.

The tweets links listed in the result pages are copied in a unique list X. The elements of this X list are shuffled and then It starts to search those tweets. Surely It presses the heart button on all of those, then It maybe retweets them.

Why maybe?

Because It only retweets the ~50% of all tweets reached (but puts likes on all).

Why ~50% and not exactly 50%?

Because for little numbers, less trendingand low content keywords and few tweets in your feed (so the captured links < 30-40) It retweets about 40-65% of all tweets reached.

Instead for big numbers, most trending, with high content keywords and so if your feed contains so many tweets (so the captured links > 80-90) It's more precise and almost exactly retweets 50% of them (with a low error like 3-4%).

When It finish, It stores all the likes and retweets count in a SQLite3 database called database.db

With the -s option (only if the password matches the word stored in the database on the same record of that username) It displays (with the help of matplotlib) a chart that shows the amount of likes, retweets and followers per day.

Requirements ๐Ÿ“ฃ

  • Mozilla Firefox
  • Python >= 3.0
  • selenium (pip install selenium) OR geckodriver
  • matplotlib (python -m pip install -U matplotlib)
  • It works only with desktop-type Twitter website window

Usage ๐Ÿš€

Assuming you are in the same folder of the scripts and you run them with python3:

Usage: python twitterbot.py -u [value] {-k [values separated by comma] OR -s OR -m} OR -i OR -h

-u or --username:

    It's your twitter username(e-mail)

-k or --keywords:

    It's/They are the keyword[s] you want to crawl

    If you want to insert multiple keywords you have to separated them by comma:

    e.g. -k climatechange,techtips,python

-s or --stat:

    If you want to see your stats account with a chart.

    Insert only -u [value] -s

-m or --mine:

    If you want to crawl your feed's tweets.

    Insert only -u [value] -m

-i or --info:

    To see twitterBot info.
    
    Insert only -i

-h or --help:

    Help documentation
    
    Insert only -h

-f or --follow:

    Insert an username. The bot will check for some
    followers of that username and it tries to follow them.

    Insert -f username

Download ๐Ÿ“ก

git clone https://github.com/edoardottt/twitterBot.git

Contributing

Just open an issue / pull request.

Versioning ๐Ÿ“Š

v1.3.3.3:

    ADDED:
            - Security bugs fixed

v1.3.3.2:

    ADDED:
            - f option. Follow random accounts

v1.3.3.1:

    ADDED:
            - Refactoring
            - Added dynamical prints
            - Set the plot title
            - Fixed some knows bugs (limit print, typing errors)

v1.3.3:

    ADDED:

            - Added -i or --info option that calls print_usage(7) = version, github site, License.
            - Added -h or --help option that calls print_usage(0)
            - Added twitterBot_log.txt file function that catches the exceptions 
              and write them into it. 
            - If isn't present any option after -u calls print_usage(8) = Error 8: Bad input
            - Check if the internet connection status is active, otherwise print_usage(6) = 
              Error 6: no internet connection

    CHANGED:

            - -h or --hashtags changed in -k or --keywords

    REMOVED:

            - Print the website URL on print_usage(0)

v1.3.2:

    - Crawling updates (time, likes and retweets) print on the same line and then flush it
    - Added followers update that appears on the chart
    - Added point marker on the chart

v 1.3.1:

    - Password input not readable
    - Statistics aggregated per days
    - Bad input handled. All error prints migrated on print_usage(error_code)
    - When it's crawling, doesn't print milliseconds

v 1.3:

    - Added a better visualization of statistics for every user with matplotlib
    - With -s option now It shows a chart that shows likes and retweets for each performance performed

v 1.2.1:

    - Now It prints the links crawled in your home/search input field  

v 1.2:

    - Added some files that create an SQLite3 database and stores users and bot sessions
  
        table Users
        It contains all the users authenticated by twitter
        
        table analytics
        It contains all the likes and retweets count of all bot sessions
        
    - Fixed some known bugs (invalid credentials, bad usage..)
    - More readable usage printer

v1.1:

    - Catching some known Exceptions

v1.0:

    - First release

License ๐Ÿ“

This repository is under MIT License.
edoardoottavianelli.it to contact me.

twitterbot's People

Contributors

edoardottt 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitterbot's Issues

Data visualization parametrized #matplotlib

Situation explained

I have a file called analyze_stat.py that takes some data from a SQLite3 database.
Those data are explainable like that:
4 vectors ( with same length) : timestamps, likes, retweets, followers
Then I aggregate them per day. So I transform all the vectors in 3 Python Dictionaries (Excluding the timestamps).
Then I have 3 useful data structure. A dictionary with the likes counts, so d_likes contains as keys the days and as values the likes carried out in that day. The same for the retweets counts and the followers counts.

What I need

I use matplotlib library for visualize in a separated window the data result.
But when the days >= (20 - 30) the window is full of points and it is not understandable.
SO THE PROBLEM IS:
How to parametrize the visualization of the data?
So when there are few data, I want see stats per day, when It's too much full the screen, I want to visualize It per month. How to do that?

Alternatives I've considered
Nobody :(

Additional context
This is the data visualization per day.
Cattura

If you want I read your comment very fast, this is my website

twitter website was updated

the input tag for username and password was removed from the first page of twitter.com, now you have to click the login button to view the login page.

WARNING dbind

I you have an issue like this on linux:
(twitterbot.py:2196): dbind-WARNING **: 09:43:35.658: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files

You have to install :
sudo apt-get install at-spi2-core

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.