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

ERROR (parse_birthday_day_month) #52

Closed
Stui opened this issue Jan 18, 2020 · 8 comments
Closed

ERROR (parse_birthday_day_month) #52

Stui opened this issue Jan 18, 2020 · 8 comments
Labels
bug Something isn't working
Milestone

Comments

@Stui
Copy link

Stui commented Jan 18, 2020

Heya!

I live in Finland and our language doesn't really work well with any code or system unfortunately.

I got error message stating the following:
fb2cal ERROR (parse_birthday_day_month) Failed to parse birthday day/month. Parse failed with tooltip_content: "Firstname Lastname (torstai)", locale: "fi_FI". Day name "torstai" is not in the offset dict {'maanantaina': 1, 'tiistaina': 2, 'keskiviikkona': 3, 'torstaina': 4, 'perjantaina': 5, 'lauantaina': 6, 'sunnuntaina': 7}

Basically the ending "na" could be left out and I'd be happy.

Is there any way I can force certain locale like en_GB for the output file because it'd be OK for me to have those birthdays in English. Or do you have any other suggestions?

@mobeigi mobeigi added the question Further information is requested label Jan 19, 2020
@adilsond
Copy link

I got the same error here in Brazil. For some reason the dictionary returns days like 'segunda, terça, quarta....' and facebook returns the days in a complete form like 'segunda-feira, terça-feira, quarta-feira...'. Then I wrote a workaround in fb2cal.py to fix this:

`
diff --git a/src/fb2cal.py b/src/fb2cal.py
index 95a2e4e..be199ec 100644
--- a/src/fb2cal.py
+++ b/src/fb2cal.py
@@ -623,6 +623,20 @@ def parse_birthday_day_month(tooltip_content, name, user_locale):
# Use beautiful soup to parse special html codes properly before matching with our dict
day_name = BeautifulSoup(birthday_date_str, 'lxml').get_text().lower()

  •    # Workaround for pt_BR Day names that differs from babel dictionary
    
  •    feira = '-feira'
    
  •    if day_name == 'segunda':
    
  •       day_name = day_name+feira
    
  •    elif day_name == 'terça':
    
  •       day_name = day_name+feira
    
  •    elif day_name == 'quarta':
    
  •       day_name = day_name+feira
    
  •    elif day_name == 'quinta':
    
  •       day_name = day_name+feira
    
  •    elif day_name == 'sexta':
    
  •       day_name = day_name+feira
    
  •    if day_name in offset_dict:
           cur_date = cur_date + relativedelta(days=offset_dict[day_name])
           return (cur_date.day, cur_date.month)
    

`

You can adapt this code for the finnish language.
day-week-pt-BR.diff.txt

@regisfso
Copy link

You can change your language to English here and the code will work fine:
https://www.facebook.com/settings?tab=language&edited=account
I suggest to the author put that information on the tutorial/read me.

@epassaro
Copy link

Yes, changing the Facebook language to English solves the problem.

@mobeigi mobeigi added bug Something isn't working and removed question Further information is requested labels Apr 20, 2020
@mobeigi
Copy link
Owner

mobeigi commented Apr 20, 2020

Unfortunately due to the way the script works (scraper) it relies on matching the day names from the Facebook page. I think an override system would end up being nicer with a fall back to babel names as backup.

Changing your Facebook language to English is a quick fix though. Added a note about that to readme.

@JeremyPgt
Copy link

Hi. Encountering the same issue. I'm French and made sure to switch the FB locale to English (UK or US) and still hit the exact same issue no matter what I try. The script stops with an error for a friend with a birthday on July 7th.

@mobeigi
Copy link
Owner

mobeigi commented Nov 6, 2020

@JeremyPgt Try following the troubleshooting steps in the readme and emailing me the log.

@JeremyPgt
Copy link

@mobeigi Thanks a lot for your response. Sending you the log.

@mobeigi mobeigi added this to the 1.2.0 milestone Nov 11, 2020
@mobeigi
Copy link
Owner

mobeigi commented Nov 12, 2020

@Stui @JeremyPgt

Hello, I just want to say the script is updated now to use a completely new method for data retrieval. This issue should not happen again. I'm not sure if you ever solved the problem so just letting you know.

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

6 participants