Package: facebook-event-aggregator
Facebook Event AggregatorA 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 thearchive-before-rework branchHow-to guidesPrerequisitesPrerequisites: >= py3.10, pip, gitInstalling prerequisitesIf running on a distro supporting rpm/yum, useyum 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-chromedriverRun locallypython3.10-mpipinstall--upgradefacebook-event-aggregatorecho"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 alsocrontab guru!docker run -i facebook-event-aggregator --host-domain ...Run testsgitclonehttps://github.com/Denperidge/facebook-event-aggregator.gitcdfacebook-event-aggregator
makeinstall-test
maketestDon'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"
    ```DiscussionsContributingMake sure to run thepipreqscommand 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 sessionBesides 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).ReferenceMaintaining/troubleshootingThis application is made to be as platform-agnostic as possible. However, the weak link is in the Facebook scraping. The parse_* functions insrc/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) hereexport/- Everything concerning turning the Event objects into viewable datatemplates/- Jinja templates used to render the static websiteto_html.py- Code that implements the above Jinja templates to create public/index.htmlto_ics.py- Code that turns Event objects into (a) .ics file(s)scrape_and_parse/- Everything concerning scraping information into JSON & Event objectsdriver.py- Selenium Driver settings (selected browser, startup args...)fb_login.py- Handles logging into Facebooklocale.py- Handles convertingwww.facebookto lang-country.facebook and backregex.py- Includes regex patterns and functions to use themscrape_and_parse.py- Handles the actual scraping & parsing partEvent.py- Python Class to handle Eventsmain.py- Entrypoint that combines everything into one scriptrepo.py- Handles the upkeep of the repo within public/public/ - Generated at runtime, contains the end result/exported filesrequirements.txt- Python packages that have to be installedLicenseAll the code written by me in this repository is licensed under theMIT License.