Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giulionf/realtweetornotbot
Scans screenshots of tweets on reddit and links the corresponding tweet
https://github.com/giulionf/realtweetornotbot
Last synced: 3 months ago
JSON representation
Scans screenshots of tweets on reddit and links the corresponding tweet
- Host: GitHub
- URL: https://github.com/giulionf/realtweetornotbot
- Owner: giulionf
- License: mit
- Created: 2018-12-20T22:27:13.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-03T17:28:21.000Z (6 months ago)
- Last Synced: 2024-05-03T19:32:46.754Z (6 months ago)
- Language: Python
- Homepage: https://www.reddit.com/u/realtweetornotbot
- Size: 173 KB
- Stars: 76
- Watchers: 1
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# RealTweetOrNotBot
*NOTE* This repository is unfortunately retired as the Twitter API does not allow reading tweets in free tier anymore.The [Reddit](https://www.reddit.com/r/realtweetornotbot/) Tweet Finder Bot
The bot is currently (13th of December 2019) ranked as the number one bot on Reddit by the unofficial [Reddit bot Ranking](https://botrank.pastimes.eu/)!
RealTweetOrNotBot is a Reddit Bot, that analyzes image posts in given SubReddits and - if it detects a twitter
screenshot - posts a link to it in the comments. It is written in [Python3].# Setup
To function you need to install the required modules from the requirements.txt using:
```sh
pip install requirements.txt
```Once that's done, you need to set certain environment variables to keep sensitive information out of the code.
| Environment Variable | Description |
| ------------- | ------------- |
| REDDIT_CLIENT_ID | Reddit API Client ID |
| REDDIT_CLIENT_SECRET | Reddit API Client Secret |
| REDDIT_USER_AGENT | Reddit API User Agent |
| REDDIT_FETCH_COUNT | Numeric Value representing how many posts are fetched with every cycle |
| REDDIT_SUMMON_COUNT | Numeric value of username summons to be fetched every cycle |
| REDDIT_USERNAME | Username of the Bot's Reddit account |
| REDDIT_PASSWORD | Password of the Bot's Reddit account |
| REDDIT_POST_MAX_AGE_DAYS | Numeric value of how old a fetched post can be at max |
| REDDIT_SUBREDDITS | List of subreddits joined by a + symbol e.g. "me_irl+whitepeopletwitter+meirl+2meirl4meirl"|
| DATABASE_URL | URL to your PostGres Database |
| DATABASE_USER | User to log into the Database |
| DATABASE_PASSWORD | Password to log into the Database |
| SEARCHTWEETS_BEARER_TOKEN | Twitter API Bearer Token |
| SEARCHTWEETS_ENDPOINT | Endpoint used for searching tweets on the Twitter API |
| WORKER_COUNT | Amount of worker threads to process a request simultaneously |
| TWITTER_API_MAX_AGE_DAYS | Max age of tweets to process - 7 is the limit for free tier of Twitter API |
| RUN_MODE | 'release' or 'debug', depending on which way to run the bot. |
| RUN_INFINITELY | 1 if run in infinite loop or 0 if only running one routine |## Database Setup
To use the bot a database is needed. It can be a local database or a remote one specified in the Environment Variables of the Operating System. Use the following Queries to create the needed tables:```sh
CREATE TABLE seen_posts (
"id" SERIAL PRIMARY KEY,
"post_id" VARCHAR (255),
"found_tweet" VARCHAR (255)
);
``````sh
CREATE TABLE summary (
"id" SERIAL PRIMARY KEY,
"time" timestamp DEFAULT CURRENT_TIMESTAMP,
"posts_seen" integer,
"tweets_found" integer,
"last_post_id" integer
);
```# Running the Bot
The Bot is configured to be running on [Heroku] but can be run just as well on any Operating System supporting Python.
To run the bot, use:```sh
python src/main.py
```[//]: #
[Python3]:
[PRAW]: