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

quote_of_the_day errors with some languages : best way to fix ? #33

Open
ikario404 opened this issue Feb 23, 2024 · 1 comment
Open

Comments

@ikario404
Copy link

Hi

I recently noticed an error throwing from quote_of_the_day() function with 'param lang=fr'.

I also watched french webpage for wikiquote and it havent the ID "mf-qotd" in it. I am not totally sure what could be the best fix regarding the code : better for an exception or is there a more generic id or xpath formula to catch it ?

Based on supported language I have also noted that error for : fr, eu, pl, pt

Tell me if you need more details but I guess it is easily reproductible

thanks for your work I love wikiquote on some of my shells :)

$ wikiquote.quote_of_the_day(lang="fr")
MissingQOTDException: Unable to retrieve quote of the day. This is probably due to a recent change in Wikiquote's main page page layout. Please try again later. If the problem persists, open an issue at: https://github.com/federicotdn/wikiquote
``
@ikario404 ikario404 changed the title quote_of_the_day errors with some language : best way to fix ? quote_of_the_day errors with some languages : best way to fix ? Feb 23, 2024
@federicotdn
Copy link
Owner

Hi! yes good observation, this has been the largest pain point in developing this library. Honestly the best idea I've had till now was to try multiple extraction methods until one works, for example for French I try two in a row:
https://github.com/federicotdn/wikiquote/blob/main/wikiquote/langs/fr.py

However even this does not always work, because the Wikiquote page layouts vary sometimes in subtle ways that break the scripts. I am definitely open to new ideas that might help to fix this !

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

No branches or pull requests

2 participants