Skip to content
/ fbgs Public

Python and selenium based (mobile) Facebook groups scraper, independent of obfuscated css selectors.

License

Notifications You must be signed in to change notification settings

lesander/fbgs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facebook group scraper

A simple selenium-dependent python scraper for Facebook groups.

Requirements:

  • Python 3.6 or newer
  • Selenium (automatically installed)

Installing

Install via pypi: fbgs

# pypi
pip3 install fbgs

# local
git clone https://github.com/lesander/facebook-group-scraper.git
cd facebook-group-scraper/
pip3 install -r requirements.txt

Usage

Cli usage:

# local & pypi
python3 -m fbgs \
--username user@example.com \
--password "example-password" \
--url https://m.facebook.com/groups/group-name \
--output ./path/for/output.json \
--no-shell  # toggle to disable default selenium interactive prompt

Programmatic usage:

from fbgs import FacebookScraper
from fbgs.exceptions import ScraperException
try:
    scraper = FacebookScraper(
        username="user@example.com", password="example-password")
    scraper.login()
    group = scraper.scrape_group(url="https://m.facebook.com/groups/group-name", out="output-example.json")
    
    # results are stored in group
    print(group.name, len(group.posts))
    
    # you can start a live interaction with the selenium driver
    scraper.interactive()
except ScraperException as e:
    print(f'ScraperException: {e}')

About

Python and selenium based (mobile) Facebook groups scraper, independent of obfuscated css selectors.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages