A Python-based desktop application built with tweepy and tkinter to search for posts on X (Twitter), reply to them, and like them, with a graphical user interface (GUI). The app supports rate limit handling, customizable search options, and detailed logging for API interactions.
- Search Posts: Search for recent X posts by keywords, date range, and filters (e.g., verified accounts only, exclude replies).
- Reply to Posts: Post replies to selected search results with customizable text.
- Like Posts: Like selected posts from search results.
- Rate Limit Management: Automatically retries API calls upon hitting rate limits, with configurable retry intervals.
- GUI Interface: User-friendly interface built with
tkinterfor easy interaction. - Statistics Tracking: View API call statistics (e.g., average duration) based on your license level.
- Logging: Detailed logs of API calls stored in
api_call_log.json. - Configurable Options: Customize search filters, license level, and debug mode via an options menu.
- Python 3.7+
- X (Twitter) API credentials (Free, Basic, or Pro tier)
- Required Python packages (listed in Installation)
- Clone the Repository:
git clone https://github.com/yourusername/x-post-search-reply.git cd x-post-search-reply - Set Up a Virtual Environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install Dependencies:
pip install tweepy requests python-dotenv tkinter
- Configure API Credentials:
- Create a file named cred.env in the project root directory.
- Add your X API credentials in the following format:
API_KEY=your_api_key API_SECRET=your_api_secret ACCESS_TOKEN=your_access_token ACCESS_TOKEN_SECRET=your_access_token_secret BEARER_TOKEN=your_bearer_token
- Obtain these credentials from the X Developer Portal (https://developer.twitter.com/).
- Start the App:
- Run the application from the command line:
python main.py
- Replace
main.pywith the actual filename if it differs.
- Run the application from the command line:
- Interacting with the Main Interface:
- Search Inputs:
- Enter keywords to search for (e.g., "python xai").
- Specify a start date/time (format:
YYYY-MM-DD HH:MM). - Specify an end date/time (format:
YYYY-MM-DD HH:MM).
- Search Button:
- Click "Search Posts" to retrieve matching posts from X.
- Found Posts:
- View results in a scrollable list.
- Uncheck posts to exclude them from subsequent actions.
- Actions:
- Check "Reply to posts" and/or "Like posts" to select actions.
- Click "Execute Actions" to perform the selected actions on checked posts.
- Search Inputs:
- Customizing Settings:
- Access via the "Options" button in the main window.
- Configure the following:
- Search Filters: Toggle "Search only for verified accounts" and "Exclude replies in search".
- API License Level: Select your tier (Free, Basic, Pro).
- Retry Interval: Set the fallback retry delay (in minutes).
- Debug Mode: Enable/disable detailed logging.
- Monitoring Activity:
- A separate window displays real-time logs.
- Shows updates on actions, API call statuses, and errors.
- Viewing API Stats:
- Click "Show Stats" in the main window.
- Displays API call statistics (e.g., average duration) based on your license level.
- Supported Tiers: The app supports three X API tiers with predefined rate limits:
- Free:
- Searches: 1 per 15 minutes
- Replies: 17 per 24 hours
- Likes: 1 per 15 minutes
- Basic:
- Searches: 60 per 15 minutes
- Replies: 100 per 24 hours
- Likes: 200 per 24 hours
- Pro:
- Searches: 300 per 15 minutes
- Replies: 100 per 15 minutes
- Likes: 1000 per 24 hours
- Free:
- Storage: Options are saved in
user_options.json. - Available Settings:
license_level:- Description: Sets your API tier.
- Default:
"Free". - Options:
"Free","Basic","Pro".
verified_only:- Description: Limits searches to verified accounts only.
- Default:
False. - Options:
True,False.
no_replies:- Description: Excludes replies from search results.
- Default:
False. - Options:
True,False.
retry_interval:- Description: Fallback retry delay for API calls (in minutes).
- Default:
5. - Options:
5,15,30,60.
debug_mode:- Description: Enables detailed debug logging.
- Default:
False. - Options:
True,False.
- Log File: API call logs are stored in
api_call_log.json. - Details Captured:
- API reference (e.g., endpoint called).
- Timestamp of the call.
- Duration of the call.
- Response status (success or failure).
- The app automatically retries API calls when rate limits are hit (up to 6 retries).
- Retry delays are calculated based on:
x-rate-limit-resetorx-user-limit-24hour-resetheaders (if available).- Fallback to 15-minute or 24-hour windows based on your license level and action type.
- Authentication Failure:
- Ensure all credentials in
cred.envare correct and match your API tier.
- Ensure all credentials in
- No Posts Found:
- Check your search query, date range, and API rate limits.
- GUI Issues:
- Verify
tkinteris installed and compatible with your Python version.
- Verify
- Rate Limit Errors:
- Adjust your license level in options or wait for the reset period.
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature
- Commit your changes:
git commit -m "Add your feature" - Push to the branch:
git push origin feature/your-feature
- Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Tweepy for X API integration.
- Uses tkinter for the GUI.