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

Automatically retrieve difficulty labels from existing guides #4

Open
benoit74 opened this issue Apr 6, 2022 · 1 comment
Open
Labels
enhancement New feature or request priority 3 Low priority stale

Comments

@benoit74
Copy link
Collaborator

benoit74 commented Apr 6, 2022

As of today, iFixit API is reporting guide difficulty with a label which depends on the language selected (i.e. if you browse https://pt.ifixit.com/api/2.0/guides/... the guide difficulty will be in Portugues).

To accomodate with this fact, we have created a list of difficulty labels in constants.py

# Open this URL in the various languages to retrieve labels below
# https://www.ifixit.com/api/2.0/guides?guideids=219,220,202,206,46465
DIFFICULTY_VERY_EASY = [
"Very easy",
"Muito fácil",
"Très facile",
"Sehr einfach",
"Muy fácil",
"Molto facile",
"Çok kolay",
"とても簡単",
"Zeer eenvoudig",
"Очень просто",
"아주 쉬움",
"非常容易",
] # guide 219
DIFFICULTY_EASY = [
"Easy",
"Fácil",
"Facile",
"Einfach",
"Fácil",
"Facile",
"Kolay",
"簡単",
"Eenvoudig",
"Просто",
"쉬움",
"简单",
] # guide 220
DIFFICULTY_MODERATE = [
"Moderate",
"Moderado",
"Modérée",
"Mittel",
"Moderado",
"Moderato",
"Orta",
"普通",
"Gemiddeld",
"Средняя",
"보통",
"中等",
] # guide 202
DIFFICULTY_HARD = [
"Difficult",
"Difícil",
"Difficile",
"Schwierig",
"Difícil",
"Difficile",
"Zor",
"難しい",
"Moeilijk",
"Сложно",
"어려움",
"困难",
] # guide 206
DIFFICULTY_VERY_HARD = [
"Very difficult",
"Muito difícil",
"Très difficile",
"Sehr schwierig",
"Muy difícil",
"Molto difficile",
"Çok zor",
"とても難しい",
"Zeer moeilijk",
"Очень сложно",
"매우 어려움",
"非常困难",
] # guide 46465

It would be preferable to retrieve automatically this list from a pre-made list of guides (and assume we will maintain only the english version to check that the guides difficulty has not been changed since last scraping).

The configuration in constants.py would then only hold a set of difficulties with following properties:

  • difficulty label in English
  • ID of a guide with this difficulty
  • CSS class to apply for this difficulty

The following process could be done at the scraper start:

  • retrieve all guides IDs stored in config for the various difficulties in all configured languages
  • check that the english version difficulty labels did not change, otherwise fail. Mention that this failure could be either because the guide difficulty has been updated - in which case we will have to find another guide with the appropriate difficulty - or because the label for this difficulty has been updated by iFixit - in which case we will have to update our configuration in constants.py
@benoit74 benoit74 added enhancement New feature or request priority 3 Low priority labels Apr 6, 2022
@stale
Copy link

stale bot commented Jun 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

@stale stale bot added the stale label Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority 3 Low priority stale
Projects
None yet
Development

No branches or pull requests

1 participant