This LinkedIn Automation Bot allows you to interact with posts and create your own posts on LinkedIn, using Google Gemini AI to generate insightful comments and posts. It's built using Python, Selenium, and other powerful libraries to automate liking, commenting, and posting on LinkedIn.
- Auto-Commenting: Analyzes posts and generates relevant comments using Google Gemini's AI models.
- Auto-Liking: Automatically likes posts based on content analysis.
- Auto-Posting: Publishes posts directly on LinkedIn, leveraging AI to create engaging and tailored posts.
- Content Filtering: Removes markdown and formats comments for a seamless look.
- Python OOP: The bot is built with Object-Oriented Programming principles for modularity and maintainability.
- Selenium WebDriver: Automates browser interactions with LinkedIn's web interface.
- Google Gemini API: Provides AI-generated comments and posts using the Gemini language model.
- BeautifulSoup: Extracts and processes LinkedIn post content.
- Logging: Logs every step and handles errors gracefully.
- Python 3.7 or later
- Google Gemini API key
- Selenium WebDriver and ChromeDriver
-
Clone the Repository:
git clone https://github.com/joeygoesgrey/linkedln-bot.git cd linkedin-bot
-
Create a Pipenv Environment and Install Dependencies:
pipenv install
-
Activate the Pipenv Shell:
pipenv shell
-
Set Up Environment Variables:
- Create a
.env
file in the root directory with your LinkedIn credentials and Google Gemini API key:
LINKEDLN_USERNAME=your_linkedln_username LINKEDLN_PASSWORD=your_linkedln_password GEMINI_API_KEY=your_gemini_api_key
- Create a
-
Download ChromeDriver: ChromeDriver is required for Selenium to interact with the Chrome browser. With
webdriver-manager
included in the dependencies, no separate download is needed.
-
Run the Bot: Start the bot using:
python browser.py
-
Available Methods:
fetch_and_store_content()
: Fetches and stores LinkedIn post data.analyze_and_interact()
: Analyzes the stored posts and interacts based on AI analysis.function_to_make_a_post()
: Automates posting directly to LinkedIn.
- Ethics and Compliance: Use the bot responsibly and follow LinkedIn's terms of service to avoid account restrictions.
- Rate Limiting: Ensure the bot operates at reasonable intervals to mimic natural user behavior.
Contributions are welcome! Feel free to fork the repository and submit a pull request with your enhancements or bug fixes.