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

Facebook BirthdayCometRootQuery offset_month logic is wrong. (No results for December) #97

Closed
axtck opened this issue May 1, 2021 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@axtck
Copy link

axtck commented May 1, 2021

This is probably not an issue with the code but when I extract the events, I don't get any results for the month december. In the ics file, there are no entries with

DTSTART;VALUE=DATE:202112...
or
DTSTART;VALUE=DATE:202212...

I extracted them last week (april)
What could be causing this?

@mobeigi mobeigi added the bug Something isn't working label May 2, 2021
@mobeigi
Copy link
Owner

mobeigi commented May 2, 2021

That is interesting, I just ran the script and can confirm what you see here (no December results).
The endpoint we use fetches the birthdays 3 months at a time but for Oct, Nov, Dec it seems to be skipping Dec.

Funnily enough the official Facebook page here also has the month of December missing:
https://www.facebook.com/events/birthdays/

So look like a new off by 1 bug Facebook introduced.
I've reported the bug to them, hopefully they can fix it.

@axtck
Copy link
Author

axtck commented May 3, 2021

Strange indeed, let we know if you get an answer!

@adilsond
Copy link

adilsond commented Jul 2, 2021

The results for december is back. But the problem now is for the current month. When I get all birthdays from december, all results from june is gone last month. Today, all results from june is back for 2022 but it erases all birthdays from july.

Now this bug makes this script useless :/

@mobeigi
Copy link
Owner

mobeigi commented Jul 3, 2021

Not quite sure what Facebook is doing as it seems the offset logic is still quite broken but we can implement a workaround for now.

Previously we had the following code:
for offset_month in [1, 4, 7, 10]:

Which would give you the next 3 months of Birthdays starting from the current month. With 4 requests we got all the birthdays for the following year.

After the recent Facebook changes the query had odd logic for the offset_month.

As of July 2021:

0 July, Aug, Sept
1 Aug, Sept, Oct
2 Sept, Oct, Nov
3 Oct, Nov, Dec
4 Nov, Dec, Jan
5 Dec, Jan, Feb
6 Jan, Feb, March
7 Jan, Feb, March
8 Feb, March, April
9 March, April, May
10 April, May, June

Notice how the offset_months for 6 and 7 overlap (which is wrong). If you use the Facebook birthday page https://www.facebook.com/events/birthdays/ and scroll down enough you'll see that one month will be missing at the end of next year (in this case June 2022 is missing which is the offset 11 from July 2021).

So as a workaround we're going to do this and get some overlapping datasets at the expense of 1 extra request but we don't store duplicates in our set so the final result is correct.

# TODO: See #97, offset_month of 10 is needed here because offset months 6/7 are currently returning equivalent months
for offset_month in [0, 3, 6, 9, 10]:

Anyway, this has been fixed with a workaround in #103
It will may break again when Facebook changes their API again so we can make a new issue when that happens.

@mobeigi mobeigi closed this as completed in f0dd5c0 Jul 3, 2021
@mobeigi mobeigi changed the title No results for december Facebook BirthdayCometRootQuery offset_month logic is wrong. (No results for December) Jul 3, 2021
@mobeigi mobeigi added this to the 1.2.3 milestone Jul 3, 2021
mobeigi added a commit that referenced this issue May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants