Before using this bot, you need Reddit API credentials. Follow these steps:
-
Create a Reddit App:
- Go to Reddit Developer Portal.
- Click Create App at the bottom.
- Choose "script" as the type.
- Fill in the app details (Name, Description, Redirect URI:
http://localhost). - Submit and copy your
client_idandclient_secret.
-
Create a
.envFile- In the project directory, create a
.envfile. - Add the following credentials:
REDDIT_CLIENT_ID=your_client_id REDDIT_CLIENT_SECRET=your_client_secret REDDIT_USER_AGENT=your_user_agent REDDIT_USERNAME=your_username REDDIT_PASSWORD=your_password OPENAI_API_KEY=your_openai_api_key
- In the project directory, create a
This bot automates posting content to multiple subreddits while avoiding plagiarism through subtle title rephrasing. Here's the workflow:
-
Extracting Post Data:
- The bot fetches a post using its Reddit post ID.
- It retrieves the title, text content, and image (if available).
- If an image is present, it downloads and saves it.
-
Generating Rephrased Titles:
- The bot counts the number of target subreddits (
n). - It asks OpenAI to generate
nsubtly rephrased versions of the title. - OpenAI returns a JSON object containing a list of these reworded titles.
- The bot counts the number of target subreddits (
-
Posting to Subreddits:
- The bot iterates over the list of target subreddits.
- It fetches available flair templates (if accessible) and selects the first flair.
- It posts the content with a rephrased title and flair (if available).
- A random sleep interval between 100-150 seconds is used between posts.
- The bot catches errors (such as permission issues) and continues posting instead of crashing.
-
Completion Report:
- After posting, it prints the number of successful and failed posts.
This bot works but has several limitations that can be improved:
- Random Flair Selection: Currently, it selects the first available flair. AI could be used to analyze the title and choose the most relevant flair.
- More Human-like Delays: The current random sleep interval is basic. Implementing variable post timings based on subreddit activity could reduce detection risks.
- Better Error Handling: Some errors (e.g., subreddit bans, rate limits) could be handled more gracefully.
- Account Safety Mechanisms: Implementing different Reddit accounts for different subreddits and using proxies could help avoid bans.
π¨ This bot works, but it gets accounts suspended! π¨
- Reddit has strict anti-bot policies, and automated posting can lead to account suspensions.
- Using this bot on public subreddits without permissions may result in subreddit bans.
- Always test in private or bot-friendly subreddits.
If you use this bot as it is, be prepared to lose your account. You have been warned. β οΈ
Final Note: The code is documented and structured for improvement. If you want to refine it, go aheadβbut be mindful of Reddit's policies. π