Can be used to get Posts and Comments using FB API. Integrate fb_token_generator
to get new access token every hour and use it to get fb data continously without having to manually replace token.
To run the code, setup using following commands in a terminal(Linux/Mac)**
git clone https://github.com/scottydelta/fb_data_scraper.git
cd fb_data_scraper
virtualenv .env
source .env/bin/activate
cd src
pip install -r requirements
**Assuming that PostgreSQL, pip and virtualenv are installed.
- Edit the
settings.py
and add/change the DB URI(DB name) or db user or password for Postgres. - Get ACCESS_TOKEN from Facebook and insert in the
settings.py
. - Add the list of pages you want to scrape.
- Execute
python manage.py createdb
to create the tables and initialize the tables** - Execute
python fb_data.py
to execute the script to get posts and comments from a page.
**Assuming the Database is already created in Postgres