Giter VIP home page Giter VIP logo

edoardottt / twitterbot2 Goto Github PK

View Code? Open in Web Editor NEW
56.0 3.0 8.0 754 KB

Like and retweet your tweets, or search tweets by topic. It stores and serves data with a Flask webapp. ๐Ÿฆ Live demo running on twitter.com/ai_testing

Home Page: https://edoardoottavianelli.it

License: GNU General Public License v3.0

Python 74.63% Shell 1.64% HTML 13.81% CSS 4.20% JavaScript 5.71%
twitter twitter-bot twitter-api twitterbot twitter-client bot bots tweets tweet-analysis tweet

twitterbot2's Introduction


Simple bot for twitter.

Coded with ๐Ÿ’™ by edoardottt

Description โ€ข Install โ€ข Usage โ€ข Notes โ€ข Contributing โ€ข License
live demo running on @ai_testing

Description ๐Ÿ”ฆ

Simple twitter bot that can like and retweet your tweets, or search tweets with a specified topic. It stores and serves data with a Flask webapp. ๐Ÿฆ

Installation ๐Ÿ“ก

  • git clone https://github.com/edoardottt/twitterbot2
  • cd twitterbot2
  • pip install -r requirements.txt
  • Edit the config.yaml and globals.py files
  • python init_db.py
  • python twitterbot2.py -h

Usage ๐Ÿš€

usage: twitterbot2.py [-h] [-v] [-t] [-k KEYWORD] [-p PORT] [-nu] [-nl] [-nr] [-s STATS] [-oc OUTPUT_CSV] [-oj OUTPUT_JSON] [-oh OUTPUT_HTML]

Twitterbot v2

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Show the version of this program.
  -t, --timeline        Search for tweets in the bot and user's timeline.
  -k KEYWORD, --keyword KEYWORD
                        Search for tweets with defined keyword(s). If more than one, comma separated enclosed in double quotes.
  -p PORT, --port PORT  Set the port to be used (default 5555).
  -nu, --no-user        Don't like and retweet user tweets.
  -nl, --no-like        Don't like tweets, just retweet.
  -nr, --no-retweet     Don't retweet tweets, just like.
  -s STATS, --stats STATS
                        Show the statistics of the inputted bot (username).
  -oc OUTPUT_CSV, --output-csv OUTPUT_CSV
                        Produce a csv file containing the stats for the inputted used (ALL for anyone).
  -oj OUTPUT_JSON, --output-json OUTPUT_JSON
                        Produce a json file containing the stats for the inputted used (ALL for anyone).
  -oh OUTPUT_HTML, --output-html OUTPUT_HTML
                        Produce a html file containing the stats for the inputted used (ALL for anyone).

See some examples to get started.

Useful notes/links ๐Ÿ”—

Changelog ๐Ÿ“Œ

Detailed changes for each release are documented in the release notes.

Contributing ๐Ÿค

If you want to contribute to this project, you can start opening an issue/pull request.
Read also Code of Conduct and Contributing files.

License ๐Ÿ“

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

twitterbot2'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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

twitterbot2's Issues

[APIv2.0] the statistics remain at zero. not working

Hello, first of all thanks for the work (I wrote to you last night)

  1. I have tried countless times but no tweets, followers from message boards are being picked up. I tried both making new tweets a) on the manager account's wall and b) on the bot's wall.
    The two accounts (manager and bot) are linked. I entered all credentials as described in your guide.

Now,

  • or I didn't understand how the system works,
  • -or are the API (ON TWITTER) limited? ( I'm using the basic version of the API on default project)

This my example commands:

  • python3 twitterbot2.py -t
  • python3 twitterbot2.py -nu -k soccer
  1. Also didn't understand if multiple users can be followed. I also did some tests by manually inserting new users into the database.db file.

  2. In any case, in the globals.py file I have inserted the 2 connected twitter accounts.
    On the command line, the response is always thiS:

INFO:2023-05-17 02:37:53,563 | Today tweets count: 0
INFO:2023-05-17 02:37:53,563 | Today likes count: 0
INFO:2023-05-17 02:37:53,563 | Today retweets count: 0
INFO:2023-05-17 02:37:53,563 | Followers count: 0
 * Serving Flask app 'server'
 * Debug mode: off
ERROR:2023-05-17 02:37:53,718 | [Errno 104] Connection reset by peer
INFO:2023-05-17 02:37:53,718 | Sleeping for five minutes.
INFO:2023-05-17 02:42:53,810 | Sleeping for one minute.
ERROR:2023-05-17 02:46:04,645 | [Errno 104] Connection reset by peer
INFO:2023-05-17 02:46:04,645 | Sleeping for five minutes.
ERROR:2023-05-17 02:51:04,876 | [Errno 104] Connection reset by peer
INFO:2023-05-17 02:51:04,877 | Sleeping for five minutes.

Thank, again, for the work

Set correct chart width when refresh

When the page is refreshed the width value of the chart is not set anymore to the previous value. For example if I set the chart width to 70% and then I refresh the page or the page refresh itself, the chart width will be set to the standard value.

Maybe local storage? session storage?

HTML output

Maybe provide a way to extract data into HTML ?

Unable to run any search

hi,
When I attempt to run any of the options, (eg python twitterbot2.py -t = '@ikoworske'), I receive below error message. Could there be something that I am missing?

Traceback (most recent call last):
File "C:\Util\Environments\twitterbot2\twitterbot2.py", line 578, in
main()
File "C:\Util\Environments\twitterbot2\twitterbot2.py", line 539, in main
bot = create_bot(logger)
File "C:\Util\Environments\twitterbot2\twitterbot2.py", line 103, in create_bot
if secretss["access_token"] is None or secretss["access_token_secret"] is None:
TypeError: string indices must be integers

Retweeting my own retweets

My twitter account is empty. I started the bot using a keyword. So it liked and reweeted some tweets. Then after a few moments, it started to tell me that it was liking and retweeting my own tweets...! I don't know if that's a "chosen feature" but it seems to be an unwanted one ! I hope I was clear.

Please contact me

Please contact me !

WhatsApp : +33768687583
Twitter : @genidumal

I need a Twitter tool, I want to know if you are able to do it ($$$$)

Data Visualization errors correct handling

  • When there aren't data for the current day, the server shows an error page saying there aren't data for today.
    The correct behaviour should be: Don't show the today's data section, just show the chart.

Send a telegram message when the bot dies

The idea could be:

  • If (and only if) the Telegram tokens/secrets are set start a new thread (called 'telegram')
  • Periodically check the status of the thread with the name 'bot'
  • If is not active send a message

Increase mobile width

When the website is shown on a smartphone the width of the body seems 70-80%.
It should be full screen

Add api endpoints

Something like:

  • HOST/api/users/<username>
  • HOST/api/followers/<username>
  • HOST/api/likes/<username>
  • HOST/api/tweets/<username>
  • HOST/api/retweets/<username>

Add uptime and status info

It would be good to have an uptime value, the status could be just a circle: green if the thread is running, red if the thread is not running

Logger error

I tried to install your twitterbot using python 3.9 and 3.10 and i have the same issue. I installed the requirements.txt and everything was fine and updated the globals.oy as it is mentionned.

You can see what happened on the screenshot.

Note : I tried to give the keyword with and without the " but I have the same issue.

image

CSV output

Maybe provide a way to extract data into CSV ?

Web service showing real time usage ?

It could be useful to serve data on a port (like 8000 ?) and just connect to ip:port to see if the bot is running, how many followers it has, which tweets it's liking and retweeting...

JSON output

Maybe provide a way to extract data into JSON ?

ValueError: Unrecognised argument(s): encoding

If twitterbot2 gives you this error:

$> python3 twitterbot2.py -h
Traceback (most recent call last):
  File "http://twitterbot2.py", line 668, in <module>
    main()
  File "http://twitterbot2.py", line 581, in main
    format=http://globals.bot_user + ": %(levelname)s:%(asctime)s | %(message)s",
  File "/Library/Frameworks/Python.framework/Versions/3.x/lib/python3.x/logging/__init__.py", line 1919, in basicConfig
    raise ValueError('Unrecognised argument(s): %s' % keys)
ValueError: Unrecognised argument(s): encoding

The problem is at this line and you have two solutions:

  • Upgrade python to version 3.9
  • OR
  • Edit your twitterbot2.py file deleting the basicConfig method and use instead:
root_logger= logging.getLogger(__name__)
root_logger.setLevel(logging.INFO)
handler = logging.FileHandler('twitterbot2.log', 'a', 'utf-8')
handler.setFormatter(logging.Formatter(globals.bot_user + ": %(levelname)s:%(asctime)s | %(message)s"))
root_logger.addHandler(handler)

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.