This script allows you to delete posts from a Facebook page using the Facebook Graph API.
Before running the script, make sure you have the following:
- Python 3.x installed on your machine with venv.
- Facebook user access token
- Facebook page ID
-
Clone the repository:
git clone https://github.com/PhuyalGaurav/facebook-delete-script
-
Navigate to the project directory:
cd facebook-delete
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.env
file in the project directory and add the following environment variables:USER_ACCESS_TOKEN=your-user-access-token PAGE_ID=your-page-id
To run the script, execute the following command:
python main.py
The script will fetch all the posts from the specified Facebook page and delete them one by one. If a post cannot be deleted, the script will retry after a 5-second delay.
Please note that this script will continuously run until manually stopped. To stop the script, press Ctrl + C
.