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

Added scraper for Drinkoteket.se #1043

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

Pebkac03
Copy link

@Pebkac03 Pebkac03 commented Mar 25, 2024

I've added a scraper for Drinkoteket.se.

This one was a bit tricky with the ingredients since they don't provide amounts in their schema. This works by parsing a list from the HTML with ingredients and then removing everything below the separator since those elements aren't part of the ingredients.

Resolves #1042

@Pebkac03 Pebkac03 mentioned this pull request Mar 25, 2024
@Pebkac03 Pebkac03 changed the title Added scraper for Drinkoteket.se Added scraper for Drinkoteket.se Closes #1023 Mar 25, 2024
@Pebkac03 Pebkac03 changed the title Added scraper for Drinkoteket.se Closes #1023 Added scraper for Drinkoteket.se Closes #1042 Mar 25, 2024
@Pebkac03 Pebkac03 changed the title Added scraper for Drinkoteket.se Closes #1042 Added scraper for Drinkoteket.se Mar 25, 2024
Comment on lines +23 to +24
def yields(self):
return 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @Pebkac03!

The only quibble I have is this return 1. I guess it makes sense that most/all of the recipes will be for a single instance of whatever cocktail is being prepared. Could you check for counter-examples even so?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, you're right. Found that some recipes where for two servings. Will probably work on it tomorrow.

else:
raw_list = ingredients_element.findAll("span")[0::2]

ingredients = [i.getText().strip() for i in raw_list]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small cleanup suggestion:

Suggested change
ingredients = [i.getText().strip() for i in raw_list]
ingredients = [i.text.strip() for i in raw_list]

@jknndy
Copy link
Collaborator

jknndy commented Mar 26, 2024

Hi @Pebkac03, just a quick note. If you add Resolves #1042 to the original description of the PR (pull request) on a new line it will automatically close the issue you opened once this PR is merged.

@Pebkac03
Copy link
Author

Pebkac03 commented May 5, 2024

Thanks, I will do that. I realized that the site has a tendency of not having a standard way of doing many things leading me to suspect a substantial risk of annoying edge cases requiring a lot of testing to be certain of it being bug-free which I currently do not have the time for. You could either merge it as is if you want, there are very few recipes with a differing serving amount or if you feel it needs to be more stable, mark it as a draft and I'll do it sometime in the future unless anyone else wants to contribute.

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

Successfully merging this pull request may close these issues.

Drinkoteket.se
3 participants