This Python script automates the process of deleting multiple photos from your imgbb account using Selenium and the Firefox web driver. The script logs into your account, selects photos in batches, and deletes them until the specified number of photos are deleted.
- Python 3.x
- Selenium
- GeckoDriver (Firefox WebDriver)
- Firefox browser installed
You can install the necessary Python packages using the following command:
pip install selenium-
Install GeckoDriver: Download the GeckoDriver from the official repository: https://github.com/mozilla/geckodriver/releases. Make sure to add GeckoDriver to your system's PATH.
-
Install Python Packages: Ensure you have Selenium installed. If not, you can install it using
pip:pip install selenium
-
Firefox Browser: This script uses Firefox as the browser. Ensure Firefox is installed on your system.
-
Clone or download this repository:
git clone https://github.com/JcHuang11234/IMGBB-Photo-Deletion.git
-
Modify the script:
Open the Python script in your preferred editor and update the following fields with your login credentials:
email_field.send_keys("YOUR-EMAIL-ADDRESS") password_field.send_keys("YOUR-PASSWORD")
-
Input the number of photos to delete:
When prompted, enter the total number of photos you want to delete from your imgbb account.
Example:
Enter the total number of photos you want to delete: 100
-
Run the script
- The script logs into your imgbb account using your email and password.
- It iterates through batches of photos (32 per batch), selects them, and deletes them.
- The script automatically calculates the number of iterations required based on the total number of photos you want to delete.
- In case of errors during deletion, the page is refreshed and the process retries.
- If imgbb changes its HTML structure, the XPath selectors in the script might break. You will need to update the XPaths accordingly.
- Ensure a stable internet connection for the script to run smoothly, as refreshing and waiting times are hardcoded.
-
Headless Mode: If you want to run the script without opening the browser window, set the
headlessoption toTruein the following line:options.headless = True
-
Delays: The script includes
time.sleep()to allow the page to load properly before each action. You can modify these delays if needed.
This project is licensed under the MIT License - see the LICENSE file for details.