Skip to content
/ fb2cal Public
forked from mobeigi/fb2cal

Fetch Facebook Birthdays events and create an ICS file for use with calendar apps

License

Notifications You must be signed in to change notification settings

ant-ds/fb2cal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


fb2cal

Facebook Birthday Events to ICS file converter


Description

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.

Requirements

  • Facebook account
  • python3.6+ (and all required python3 modules)
  • Scheduler tool to automatically run script periodically (optional)
  • Google Drive API access (optional)

Instructions

  1. Clone repo
    git clone git@github.com:mobeigi/fb2cal.git
  2. Create a Google Drive API credentials
    1. Visit the Google Drive APIs page: https://console.developers.google.com/apis/api/drive.googleapis.com/overview
    2. Create a new project (if you don't already have one)
    3. Enable API (if not already enabled)
    4. Create OAuth consent screen if required
    5. Create Credentials (OAuth client ID)
    6. Download credentials JSON file
  3. Rename credentials JSON file to credentials.json and put it in the src folder
  4. Rename config/config-template.ini to config/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.
  5. Install required python modules
    pip install -r requirements.txt
  6. Run script manually once for testing purposes: python ./fb2cal.py
  7. Check Google Drive to ensure your ics file was made.
  8. Setup Cron Jobs/Task Scheduler/Automator to repeatedly run the script to periodically generate an updated ics file. See Scheduled Task Frequency section for more info.
  9. 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 your config/config.ini file.

Configuration

This tool can be configured by editing the config/config.ini configuration file.

Section Key Valid Values Description
AUTHfb_emailYour Facebook login email
fb_passwordYour Facebook login password
DRIVEupload_to_driveTrue, FalseIf tool should automatically upload ICS file to Google Drive
drive_file_idThe file id of file to write to on Google Drive. Leave blank to create a new file for the first time.
ics_file_nameThe name of the file to be stored/updated on Google Drive.
FILESYSTEMsave_to_fileTrue, FalseIf tool should save ICS file to the local file system
ics_file_pathPath to save ICS file to (including file name)
LOGGINGlevelDEBUG, INFO, WARNING, ERROR, CRITICALLogging level to use. Default: INFO

fb2cal Setup Guide for Non-Devs [Windows]

fb2cal Setup Guide for Non-Devs [Windows]

Scheduled Task Frequency

It is recommended to run the script once every 24 hours to update the ICS file to ensure it is synchronized with the latest Facebook changes (due to friend addition/removal) and to respect the privacy of users who decide to hide their birthday later on. Facebook originally recommended polling for birthday updates once every 12 hours based on the X-PUBLISHED-TTL:PT12H header included in their ICS files.

Caveats

  • Facebook accounts secured with 2FA are currently not supported (see #9)
  • During Facebook authentication, a security checkpoint may trigger that will force you to change your Facebook password.
  • Some locales are currently not supported (see #13)

Contributions

Contributions are always welcome! Just make a pull request.

Licence

GNU General Public License v3.0

About

Fetch Facebook Birthdays events and create an ICS file for use with calendar apps

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%