Sync Facebook Birthdays to Google Calendar: Hard Mode

Facebook’s Birthday Calendar had been a lifesaver. Remembering some birthdays is okay and doable. However, remembering every birthday of every acquaintance is one, unnecessary and two, not expected.

It does feel nice to receive an unexpected birthday text, and so, I like to send them too. That’s precisely why I had my Facebook Calendar’s Birthday channel synced to my Google Calendar.

It was easy to set it up then. All you needed to do was get a Calendar URL from Facebook specifically for Birthdays and then, add that as a Google Calendar on the web interface of the same.

Enter last Monday when all birthdays disappeared. Coincidentally, I was praising the entire process on the previous weekend itself. It was disappointing, and I felt borderline betrayed.

I double-checked Facebook’s Event Page, and the calendar they now provide is only for Facebook Events, that is, no birthdays anymore.

The Hunch

Facebook has to bring that data from somewhere when you load the page. So, I, along with a friend, got to fiddling with the NetworkRequests on

That’s what a month component looks like. I’ve removed personal information.

As you scroll down on the Birthdays screen, to populate a box for whatever month is supposed to come next, a request pops up in the XHR section.

The easy way to identify it is to look for ?date=

Each corresponds to a month loading as you scroll.

That’s it! The parameter will be followed by a large number, which is nothing but the Epoch timestamp of the month’s first day.

This parameter will come in handy later, so let’s just put a pin on it.

The next step was to look at the response and fetch it. So, we decided to check the Response being sent after clicking on the request.

Hold On A Second

It was unexpected. There was no standard data format, just HTML. It was pre-rendered/compiled, and so, this wasn’t as easy as it might have looked in the first go.

Upon scanning the HTML’s content, we realised that each element has a property called data-tooltip-content which has both the Full Name and the Birthday without year for each person whose birthday falls in that month.

Not a problem. A simple RegEx expression can do the job of finding such patterns.

([a-z0–9 ]+)(\([0–9]*\\\/[0–9]*\))

Easy does it. This will give us a name, followed by their birthday. For example,

John Doe (01\/01)

Let’s Do This

Now that we have everything. The next step was to pull this off using a simple Python script.

But before we embark on the journey, let’s fill our backpack with things we’d need.

  1. The Request URL from the Network call. This is easy. Once we click on the ?date= request, we’ll be in the Headers tab. The Request URL is in the Generalsection.
  2. Scrolling down to the bottom in the same box will give us the Request Headers. We need these to make their servers believe that we’re logged in.
  3. Remove the accept-encoding parameter. This makes sure that the response we receive is plaintext instead of encoded.
  4. Finding the Epochs for each month for 2019:1546300800, 1548979200, 1551398400, 1554076800, 1556668800, 1559347200, 1561939200, 1564617600, 1567296000, 1569888000, 1572566400, 1575158400


We’re all set now. Let’s do this. To help you out, here’s a GitHub gist.

There are a few things you need to do for the script to work, though.

Here’s a list of modifications you need to make.

  • Replace YOUR_URL_HERE with your Request URL found using the method shown earlier.
  • Replace the headers section with the values from your Response Headers.
  • Remove the numeric value that looks similar to those in the epochs list and replace it with {} for it to be formatted in the loop.
  • All set, the script should produce a .csv with data for the next five years.
  • This count can be changed by changing the range in the for loop down toward the end of the code.

What Now?

The final step is to go to Google Calendar from a web browser and do the following.

  • Scroll down, find Other Calendars in the sidebar and click the + button beside it.
  • Click Create new calendar. Fill in the Name and the Description and hit Create calendar.
  • Then, in the same Other Calendars screen, click Import & Export on the sidebar.
  • Upload the .csv file, and select the calendar you just created from the drop-down.
  • Click on Import.

That’s All Folks!

The Birthdays from your Facebook should be in your Google Calendar now.

This may not be in live-sync, but it’s not that hard to redo the entire process now and then if your script is ready.

That is until Facebook stops breaking the perfectly good things about their platform.




Blogger, writer, data guy, and dreamer from Dehradun, India. I write code by day and prose by night.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Kids Matter!

What on earth is a Strategy pattern?

Diving Into the Deep End

Functions in Python

Want to Ship Code Faster? Stop Building Extra Features

Protocols of IoT

Why I Recycle Programming Problems

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Deepansh Khurana

Deepansh Khurana

Blogger, writer, data guy, and dreamer from Dehradun, India. I write code by day and prose by night.

More from Medium

Calculate a row’s all columns at one formula while looking up value from key on another sheet

The start of my largest software engineering project (Use cases, thesis, technologies and…

Dynamics 365/Model-Driven Power Apps: Solving the AADSTS50011 Error

Write a program that asks the user to enter a word and then capitalizes every other letter of that…