Skip to main content

Facebook Event Aggregator

The coverage badge

A Facebook event scraper & aggregator, that fetches multiple pages' events and exports them to a static website and .ics file, automatically pushing it to Git(Hub Pages).

If you're looking for the original script-based version, check out the archive-before-rework branch

How-to guides

Prerequisites

Prerequisites: >= py3.10, pip, git

Installing prerequisites

  • If running on a distro supporting rpm/yum, use
    • yum install google-chrome (keep note of what version is installed)
    • cd /usr/local/bin/
    • npx @puppeteer/browsers install chromedriver@121 (ensure the @VERSION is the same major version as yum installed)
  • If running on a platform without an official Chromium distrubition (e.g. Raspberry Pi 3b, Linux32...): apt-get install chromium-chromedriver

Run locally

python3.10 -m pip install --upgrade facebook-event-aggregator

echo "Optionally, add the following line to crontab to automatically run every 24 hours (can be modified ofcourse): "
# echo "0 5 * * * python3 \"$(pwd)/app/main.py\" headless update"

See also crontab guru!

docker run -i facebook-event-aggregator --host-domain ...

Run tests

git clone https://github.com/Denperidge/facebook-event-aggregator.git
cd facebook-event-aggregator
make install-test
make test
Don't forget to configure Git on the device if that's not done already! ```bash git config --global user.email "you@example.com" git config --global user.name "Your Name" ```

Discussions

Contributing

Make sure to run the pipreqs command if any modules get added to a python file. (Note: pipreqs seems to have some issues with the match statement. If that's still the case, comment those lines out before running)

GitHub Actions & why this application shouldn't be run on it & why you probably don't want to use a logged in Facebook session

Besides the hosting through GitHub Pages, everything is done locally. If you look in the branches, you'll notice an old entirely GitHub Actions based version. However, doing it locally avoids the login sequence that Facebook asks when this is run from GitHub Actions (presumably due to rate limiting). The non-logged in Facebook interface is easier to scrape, presumably due to GraphQL (although that might be incorrect).

Reference

Maintaining/troubleshooting

This application is made to be as platform-agnostic as possible. However, the weak link is in the Facebook scraping. The parse_* functions in src/facebook_event_aggregator/scraper/ are most likely to need changes down the line. So if the application doesn't find any events, look there first.

Structure (out of date)

  • app/ - All code (Python and otherwise) here
    • export/ - Everything concerning turning the Event objects into viewable data
      • templates/ - Jinja templates used to render the static website
      • to_html.py - Code that implements the above Jinja templates to create public/index.html
      • to_ics.py - Code that turns Event objects into (a) .ics file(s)
    • scrape_and_parse/ - Everything concerning scraping information into JSON & Event objects
      • driver.py - Selenium Driver settings (selected browser, startup args...)
      • fb_login.py - Handles logging into Facebook
      • locale.py - Handles converting www.facebook to lang-country.facebook and back
      • regex.py - Includes regex patterns and functions to use them
      • scrape_and_parse.py - Handles the actual scraping & parsing part
    • Event.py - Python Class to handle Events
    • main.py - Entrypoint that combines everything into one script
    • repo.py - Handles the upkeep of the repo within public/
  • public/ - Generated at runtime, contains the end result/exported files
  • requirements.txt - Python packages that have to be installed

License

All the code written by me in this repository is licensed under the MIT License.

Metadata

Release files for facebook-event-aggregator 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for facebook-event-aggregator 0.2.0
File Size Uploaded Provenance Actions
facebook_event_aggregator-0.2.0.tar.gz 22.4 kB Without provenance Details for facebook_event_aggregator-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for facebook-event-aggregator 0.2.0
File Interpreter ABI Platform Actions
facebook_event_aggregator-0.2.0-py3-none-any.whl Python 3 none any Details for facebook_event_aggregator-0.2.0-py3-none-any.whl

Total release size: 50.6 kB

Release files / facebook_event_aggregator-0.2.0.tar.gz

Download URL facebook_event_aggregator-0.2.0.tar.gz
Size 22.4 kB
Tags Source
SHA-256 checksum
How to use checksums
283509aff3b50552fac0db97a111c286492f5ca44f14ed305dd7f8ee5cfa87fd
BLAKE2b-256 checksum
How to use checksums
158ef62498204affdb4622c67e150ead377f78d6c5a4830232b63455bfd281e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / facebook_event_aggregator-0.2.0-py3-none-any.whl

Download URL facebook_event_aggregator-0.2.0-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6aee7e941686c5d6ff4e89725cbc58947afb051a090a6fbcfcad0ce34f4ee722
BLAKE2b-256 checksum
How to use checksums
0e7f3813f6f7e63d0d1ad849ee6bb2a8564748c3e398f6e761a02b914a2c0f40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.6

Security for facebook-event-aggregator 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page