{"id":21175599,"url":"https://github.com/m3y54m/twitter-retweet-bot","last_synced_at":"2025-04-13T15:51:24.238Z","repository":{"id":59177864,"uuid":"417897990","full_name":"m3y54m/twitter-retweet-bot","owner":"m3y54m","description":"A simple keyword-based retweeter bot for Twitter API V2","archived":false,"fork":false,"pushed_at":"2023-07-19T15:23:23.000Z","size":154,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-27T06:44:54.332Z","etag":null,"topics":["bot","python","tweepy","twitter","twitter-api","twitter-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m3y54m.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-10-16T17:23:28.000Z","updated_at":"2024-04-28T07:04:37.000Z","dependencies_parsed_at":"2023-01-18T08:30:56.178Z","dependency_job_id":null,"html_url":"https://github.com/m3y54m/twitter-retweet-bot","commit_stats":null,"previous_names":["m3y54m/twitter-retweet-bot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3y54m%2Ftwitter-retweet-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3y54m%2Ftwitter-retweet-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3y54m%2Ftwitter-retweet-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m3y54m%2Ftwitter-retweet-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m3y54m","download_url":"https://codeload.github.com/m3y54m/twitter-retweet-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741147,"owners_count":21154249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","python","tweepy","twitter","twitter-api","twitter-bot"],"created_at":"2024-11-20T16:59:59.829Z","updated_at":"2025-04-13T15:51:24.206Z","avatar_url":"https://github.com/m3y54m.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Retweeter Bot with Twitter API V2\n\nThis repository holds the source code of a bot that utilizes Twitter API V2.\nThe bot will constantly search through the Twitter timeline for tweets containing\nyour specified keywords, which can be edited in the `track.json` file.\n\n**Note: Due to recent changes in Twitter Developer accounts, Free plan is not able to search tweets or retweet them. You should have a Basic or Pro account to use this bot.**\n\n## Prerequisites\n\nFirst you should (or it is recommended to) install [Poetry](https://python-poetry.org/) for package management:\n\n```console\npip install poetry\n```\n\nInstall all the required packages based on `poetry.lock` using this command:\n\n```console\npoetry install\n```\n\nTo update all packages to their latest versions you can use this command:\n\n```console\npoetry update\n```\n\n## Run the bot\n\n```console\npython src/main.py\n```\n\n## Project Strcture\n\n### `src/track.json`\n\nThis bot simply uses keywords in this file to find desired tweets.\nThis file consists of two parts:\n- `include`: All keywords, hashtags, and mentions that should exist in the tweets bot is looking for.\n- `exclude`: All keywords, hashtags, and mentions that should **NOT** exist in the tweets.\n\n### `src/main.py`\n\nThis is the entry point of the program. It Gets keywords from `src/track.json` and processes them and\ngenerates valid search rules for out Twitter bot. It also runs a Flask web server to monitor or control\nthe bot's activity. Finally it runs the bot's main application.\n\n### `src/bot.py`\n\nThis file defines the application and behavior of this Twitter bot.\nIt is using Twitter API v2 StreamingClient to monitor Twitter live steam of tweets\nbased on the rules defined for it.\n\nCurrently the bot only likes and retweets the tweets that match the rules. \n\n### `src/server.py`\n\nA Flask web server is run to monitor or control the bots activity.\n\n### `src/get_access_token.py`\n\nThis file is a independent utility to generate user-specific access tokens for the bot's Twitter API app\nand the bot's functionality is not related to this file.\n\n\n## Development Resources\n\n- [Read key-value pairs from a .env file and set them as environment variables](https://github.com/theskumar/python-dotenv)\n- [Hello Tweepy](https://docs.tweepy.org/en/stable/getting_started.html)\n- [Post tweet with tweepy](https://stackoverflow.com/questions/19337672/post-tweet-with-tweepy)\n- [Obtaining Access Tokens using 3-legged OAuth flow](https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens)\n- [tweepy.Stream — Stream Reference](https://docs.tweepy.org/en/stable/stream.html)\n- [How to Make a Twitter Bot in Python With Tweepy](https://realpython.com/twitter-bot-python-tweepy)\n- [Getting Started With Flask, A Python Microframework](https://scotch.io/tutorials/getting-started-with-flask-a-python-microframework)\n- [A hello world app in Flask for deploying to Heroku.](https://github.com/leah/hello-flask-heroku)\n- [Tweet Quote Bot](https://github.com/adamichelle/tweet-quote-bot)\n- [tweepy unauthorized 401 error when retweeting](https://stackoverflow.com/questions/69563386/tweepy-unauthorized-401-error-when-retweeting)\n- [Relative imports - ModuleNotFoundError: No module named x](https://stackoverflow.com/questions/43728431/relative-imports-modulenotfounderror-no-module-named-x)\n- [Heroku: The Procfile](https://devcenter.heroku.com/articles/procfile)\n- [Twitter Retweet Bot using Python \u0026 Tweepy](https://github.com/0xGrimnir/Simple-Retweet-Bot)\n- [Wake my Dyno!](http://wakemydyno.com/)\n- [How do I allow a file to be viewed?](https://askto.pro/question/how-do-i-allow-a-file-to-be-viewed)\n- [Filter realtime Tweets](https://developer.twitter.com/en/docs/twitter-api/v1/tweets/filter-realtime/guides/basic-stream-parameters)\n- [Building a Discord Bot with Python and Repl.it](https://www.codementor.io/@garethdwyer/building-a-discord-bot-with-python-and-repl-it-miblcwejz#keeping-our-bot-alive)\n- [GitHub Webhooks](https://docs.github.com/en/developers/webhooks-and-events/webhooks)\n- [Verify GitHub webhook request sha256 in PHP](https://gist.github.com/mahdyar/711beee9fec9cab6bb2f6e48d061d077)\n- [Stream encountered HTTP error: 403](https://stackoverflow.com/questions/70031766/receiving-stream-encountered-http-error-403-when-using-twitter-api-what-is-c)\n- [PIN-based authorization](https://developer.twitter.com/en/docs/authentication/oauth-1-0a/pin-based-oauth)\n- [Twitter API V2 Programming with Python and Tweepy](https://python.plainenglish.io/twitter-api-v2-programming-with-python-and-tweepy-f6487cd4bad9)\n- [POST /2/tweets/search/stream/rules](https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/api-reference/post-tweets-search-stream-rules#tab0)\n- [Invalid Rules Problem](https://developer.twitter.com/en/support/twitter-api/error-troubleshooting#invalid-rules)\n- [Deploy on Fly.io](https://fly.io/docs/getting-started/python/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm3y54m%2Ftwitter-retweet-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm3y54m%2Ftwitter-retweet-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm3y54m%2Ftwitter-retweet-bot/lists"}