fbnix
Agent library for scraping Facebook
This library is in early development. The intention is the ability to scrape Facebook pages and groups (something Facebook does not provide full APIs for). I created this to build services that can pull updates from pages (such as events) without having to join Facebook.
Fbnix uses Puppeteer (headless Chromium) to render and scrape data from Facebook.
Usage
Install Fbnix:
npm i fbnix
a page:
Example to get post ids ofconst Fbnix = const agent = agent
Outputs:
[ '774949562842791', '774949062842841', '774938299510584', '774377139566700', '299449697564073', '774374466233634', '774373759567038', '774372742900473', '774371639567250' ]
a post:
Example withconst Fbnix = const agent = agent
Outputs:
Post by: Billy's CollectiblesPost date: 2018-11-08T15:25:05.000ZPost text: Here is the first post! Welcome!
Further examples:
The best place to look is the integration tests
Contributing
Running integration tests:
npm test
You can also run the integration tests with caching. This saves the DOM fetched from Facebook so subsequent test runs are faster. This doesn't provide code coverage.
npm run test-cache
To reset the cache delete the tests\cache\
folder