Facebook Birthday Events to ICS file converter
Around 20 June 2019, Facebook removed their Facebook Birthday ics export option.
This change was unannounced and no reason was ever released.
fb2cal is a tool which restores this functionality.
It works by calling various async endpoints that power the https://www.facebook.com/events/birthdays/ page.
After gathering a list of birthdays for all the users friends for a full year, it creates a ICS calendar file which is then stored on Google Drive as a publically shared file. This ICS file can then be imported into third party tools (such as Google Calendar).
The ICS file can also be stored on the local file system.
This tool does not use the Facebook API.
- python3.6+ (and all required python3 modules)
- Scheduler tool to automatically run script periodically
- Google Drive API access
- Clone repo
git clone git@github.com:mobeigi/fb2cal.git
- Create a Google Drive API credentials
- Visit the Google Drive APIs page: https://console.developers.google.com/apis/api/drive.googleapis.com/overview
- Create a new project (if you don't already have one)
- Enable API (if not already enabled)
- Create OAuth consent screen if required
- Create Credentials (OAuth client ID)
- Download credentials JSON file
- Rename credentials JSON file to credentials.json and put it in the
src
folder - Rename
config/config-template.ini
toconfig/config.ini
and enter your Facebook email and password as well as a name for your calender to be saved on Google Drive. Initially, the value for the drive_file_id field should be empty. - Install required python modules
pip install -r requirements.txt
- Run script manually once for testing purposes:
python ./fb2cal.py
- Check Google Drive to ensure your ics file was made.
- Setup cron jobs/Task Scheduler/Automator to repeatly run the script to periodically generate an updated ics file. It is recommended to run the script once every 24 hours.
- Use the following link to import your ics into Calendar applications (i.e. Google Calendar):
http://drive.google.com/uc?export=download&id=DRIVE_FILE_ID
. Replace DRIVE_FILE_ID with the autopopulated value found in yourconfig/config.ini
file.
This tool can be configured by editing the config/config.ini
configuration file.
Section | Key | Valid Values | Description |
---|---|---|---|
AUTH | fb_email | Your Facebook login email | |
fb_password | Your Facebook login password | ||
DRIVE | upload_to_drive | True, False | If tool should automatically upload ICS file to Google Drive |
drive_file_id | The file id of file to write to on Google Drive. Leave blank to create a new file for the first time. | ||
ics_file_name | The name of the file to be stored/updated on Google Drive. | ||
FILESYSTEM | save_to_file | True, False | If tool should save ICS file to the local file system |
ics_file_path | Path to save ICS file to (including file name) | ||
LOGGING | level | DEBUG, INFO, WARNING, ERROR, CRITICAL | Logging level to use. Default: INFO |
Contributions are always welcome! Just make a pull request.
GNU General Public License v3.0