Skip to main content

Scrape Facebook public pages without an API key.

Project description

Facebook Scraper

Scrape Facebook public pages without an API key. Inspired by twitter-scraper.

Install

pip install facebook-scraper

Usage

Send the unique page name as the first parameter and you're good to go:

>>> from facebook_scraper import get_posts

>>> for post in get_posts('nintendo', pages=1):
...     print(post['text'][:50])
...
The final step on the road to the Super Smash Bros
Were headed to PAX East 3/28-3/31 with new games

Optional parameters

  • group: group id, to scrape groups instead of pages. Default is None.
  • pages: how many pages of posts to request, usually the first page has 2 posts and the rest 4. Default is 10.
  • timeout: how many seconds to wait before timing out. Default is 5.
  • sleep: how many seconds to sleep between each request. Default is 0.
  • credentials: tuple of user and password to login before requesting the posts. Default is None.

Post example

{'post_id': '2257188721032235',
 'text': 'Don’t let this diminutive version of the Hero of Time fool you, '
         'Young Link is just as heroic as his fully grown version! Young Link '
         'joins the Super Smash Bros. series of amiibo figures!',
 'time': datetime.datetime(2019, 4, 29, 12, 0, 1),
 'image': 'https://scontent.flim16-1.fna.fbcdn.net'
          '/v/t1.0-0/cp0/e15/q65/p320x320'
          '/58680860_2257182054366235_1985558733786185728_n.jpg'
          '?_nc_cat=1&_nc_ht=scontent.flim16-1.fna'
          '&oh=31b0ba32ec7886e95a5478c479ba1d38&oe=5D6CDEE4',
 'likes': 2036,
 'comments': 214,
 'shares': 0,
 'post_url': 'https://m.facebook.com/story.php'
             '?story_fbid=2257188721032235&id=119240841493711',
 'link': 'https://bit.ly/something'}

Notes

  • There is no guarantee that every field will be extracted (they might be None).
  • Shares doesn't seem to work at the moment.
  • Group posts are only from one page.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facebook-scraper-0.1.8.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

facebook_scraper-0.1.8-py2.py3-none-any.whl (6.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file facebook-scraper-0.1.8.tar.gz.

File metadata

  • Download URL: facebook-scraper-0.1.8.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.5

File hashes

Hashes for facebook-scraper-0.1.8.tar.gz
Algorithm Hash digest
SHA256 6601a22476e31d54b1a3035bffde81587d0edaf41adc1c112e2ec7346664e1fa
MD5 c3f81fff1e6dcb76481d40f82f672a41
BLAKE2b-256 a6ecbe6a7e60384534bc425ce1c526a370a8b22f0a37e3d3a98c47c2da2eefdf

See more details on using hashes here.

File details

Details for the file facebook_scraper-0.1.8-py2.py3-none-any.whl.

File metadata

  • Download URL: facebook_scraper-0.1.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.5

File hashes

Hashes for facebook_scraper-0.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5b22b12711e45f6a416939143c741840b824bb5071c58ee29f881821142e4773
MD5 5b9c417de967dfaed4677899fb0f2d0a
BLAKE2b-256 6481a0651fa68e9acf13af4b7564a6edebd0a7ae27620362fad4e94006ff4ba0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page