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

Index Error for some recipes on happyfoodie.co.uk #594

Closed
JimmyStrings opened this issue Sep 5, 2022 · 4 comments · Fixed by #613
Closed

Index Error for some recipes on happyfoodie.co.uk #594

JimmyStrings opened this issue Sep 5, 2022 · 4 comments · Fixed by #613
Labels

Comments

@JimmyStrings
Copy link

JimmyStrings commented Sep 5, 2022

Recipe URLs that error:
https://thehappyfoodie.co.uk/recipes/ottolenghi-middle-eastern-mac-n-cheese-with-zaatar-pesto/
https://thehappyfoodie.co.uk/recipes/yotam-ottolenghis-chocolate-tarts-with-tahini/
https://thehappyfoodie.co.uk/recipes/oyster-mushroom-tacos-with-all-or-some-of-the-trimmings/

Attempted code:

from recipe_scrapers import scrape_me
scraper = scrape_me('https://thehappyfoodie.co.uk/recipes/ottolenghi-middle-eastern-mac-n-cheese-with-zaatar-pesto/')
print(scraper.ingredients())

Error Message: IndexError: list index out of range

Note: The problem seems to be that these page contains multiple sub-headings in the ingredient list. Other recipes on this website do not have multiple sub-headings and the scraper works fine:
e.g. https://thehappyfoodie.co.uk/recipes/lemon-courgette-linguine/

Python version: 3.8
Operating System: Windows 10

@jayaddison
Copy link
Collaborator

Thanks @JimmyStrings - nice finds!

Could you open one GitHub issue for each of the affected websites? Some of them look easier to handle than others, and it's useful to have details of each problem as an issue so that fixes in pull requests can be linked to them.

@JimmyStrings JimmyStrings changed the title A couple of issues identified Error for some recipes on happyfoodie.co.uk Sep 5, 2022
@JimmyStrings
Copy link
Author

Hi @jayaddison - updating this issue to contain only 1 issue. Will add other issues separately.

@JimmyStrings JimmyStrings changed the title Error for some recipes on happyfoodie.co.uk Index Error for some recipes on happyfoodie.co.uk Sep 5, 2022
@jayaddison
Copy link
Collaborator

Thanks again @JimmyStrings! Much appreciated 👍

@jayaddison jayaddison added the bug label Sep 5, 2022
@vabene1111
Copy link
Collaborator

fixed by ignoring headers and spacers from the table. PR will follow tomorrow

vabene1111 added a commit to vabene1111/recipe-scrapers that referenced this issue Sep 30, 2022
ingredient tables contained empty spacer or header rows, ignored those when importing to prevent exception
vabene1111 added a commit to vabene1111/recipe-scrapers that referenced this issue Sep 30, 2022
ingredient tables contained empty spacer or header rows, ignored those when importing to prevent exception
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants