Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grab year of birth #40

Closed
cbncbncnbvb opened this issue Sep 8, 2019 · 11 comments
Closed

Grab year of birth #40

cbncbncnbvb opened this issue Sep 8, 2019 · 11 comments
Labels
enhancement New feature or request
Milestone

Comments

@cbncbncnbvb
Copy link

Hey, first of all thank you for your script. It would be nice to have the year of birth as well (if provided by user).

I myself would love a CSV output like
userid,username,birthdate,year_of_birth rather than a ics file which outdates the next year, but thats just me.

@mobeigi mobeigi added enhancement New feature or request question Further information is requested labels Sep 9, 2019
@mobeigi
Copy link
Owner

mobeigi commented Sep 9, 2019

The year of birth is unfortunately not provided in the AJAX response we parse. We could fetch the year of birth from a users profile separely which would add len(friends_with_bdays) extra get requests. Probably need to find a more effecient way of doing this if possible.

Just FYI, the current behaviour does mimic the original Facebook feature (which did not provide year of birth). Furthermore, the ICS file won't become out of date the following year, each Birthday event repeats yearly.

Also this issue should probably be two issues, one for a CSV output feature and the other for including the birthday year.

@cbncbncnbvb
Copy link
Author

cbncbncnbvb commented Sep 9, 2019

Thank you for your quick reply.

I had a look into the code and the response in the meantime. I do not yet understand why the script is rather slow, but for yearth of birth I think the way to go is to call https://www.facebook.com/{uid}/about?section=contact_basic for every friend (well, for those friends, that do provide birthdays at all).

The code is quite easy to understand (thanks for that) and I consider modifying it myself. if you are interested, I would provide the updated code back to you.

@hybrid2102
Copy link

The code is quite easy to understand (thanks for that) and I consider modifying it myself. if you are interested, I would provide the updated code back to you.

Please, share! I'd like to have the year as well.

@mobeigi
Copy link
Owner

mobeigi commented Nov 14, 2019

@cbncbncnbvb @hybrid2102

We can add this in as extra functionality. An extra 2 minutes processing time won't hurt too much I suppose given that most people seem to run this script once.

@VladimirBelov
Copy link

Any update for birth year support inside fb2cal?

@mobeigi
Copy link
Owner

mobeigi commented Aug 19, 2020

Any update for birth year support inside fb2cal?

Not yet. The same issue exists where fetching the birth year from the users profile would incur a huge performance hit. The script would take many many minutes to run vs only taking a few seconds.

We need to find another endpoint that exposes this in bulk but it may not exist.
Keep in mind the old Birthday export feature did not support this either (there was no Birthday year, only day and month).

@VladimirBelov
Copy link

@mobeigi
Copy link
Owner

mobeigi commented Aug 21, 2020

Yeah so like I said scraping that page will be very slow and would take 10+ minutes for users with a lot of Facebook friends. Not worth the performance hit.

@mobeigi
Copy link
Owner

mobeigi commented Aug 21, 2020

With that being said there is some good news!

With the new Facebook redesign I see a new endpoint being used to power this page:
https://www.facebook.com/events/birthdays

Looks like its powered via GraphQL at https://www.facebook.com/api/graphql/ for BirthdayCometRootQuery.

image

This should be an even more efficient way to fetch all Birthdays hopefully.

@mobeigi mobeigi removed the question Further information is requested label Aug 21, 2020
@mobeigi mobeigi added this to the 1.2.0 milestone Oct 3, 2020
@mobeigi mobeigi removed this from the 1.2.0 milestone Nov 12, 2020
@mobeigi
Copy link
Owner

mobeigi commented Nov 12, 2020

Update: I looked into this and sadly we don't have the information we need.

Facebook uses a REST relay for their public GraphQL endpoint.
It uses stored queries with a doc_id field. This means we don't have control over what data to query for.

The endpoint right now returns a data set that looks like this:
image

The recent and upcoming data shows a few recent/upcoming birthdays and these are the ones that have the birthday year.
Unfortunately, we need Birthdays for all friends which we can get from viewer -> all_friends_by_birthday_month but these only contain the birthday day and month. The good news is we also now get the users Facebook id (we couldn't before)!

However, making this change is still good because it makes the script much better (because we don't need to deal with locales and languages or any complex calculations). So the change was made here: #81

The ideal solution now I think is adding an optional config setting to also fetch Birthday years manually, one for each Facebook friend. This will be very slow depending on how we do it but at least it will work for those who run this script rarely.

@mobeigi mobeigi changed the title Grab year of birth and provide a CSV output Grab year of birth May 25, 2022
@mobeigi mobeigi added this to the 1.2.4 milestone May 25, 2022
@mobeigi
Copy link
Owner

mobeigi commented May 25, 2022

Good news, a new GraphQL endpoint has been added by Facebook which is identical to the old one but includes the birthday year for all your friends!

You can run v1.2.4 of the script to now include the Birthday year.

chrome_l5vneJqVLI

And this is what it looks like if user has their birth year hidden/private.
chrome_lcOo1Khrae

PR here: #108

CC: @cbncbncnbvb , @hybrid2102 , @VladimirBelov , @bonelifer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants