Skip to content

TypeError: 'NoneType' object is not iterable on some pages #95

@tvfoodmaps

Description

@tvfoodmaps

Hi, I've been using extruct pretty successfully but came across a URL that seems to validate OK but when I run it through I get an error:

  File "/Users/frankapap/KCApp/extruct/RecipeInfoService.py", line 24, in recipeExtract
    data = extruct.extract(r.text, base_url=base_url,syntaxes=['json-ld', 'opengraph'],uniform=True)
  File "/usr/local/lib/python3.7/site-packages/extruct/_extruct.py", line 67, in extract
    output[label] = list(extract(document, base_url=base_url))
  File "/usr/local/lib/python3.7/site-packages/extruct/jsonld.py", line 25, in extract_items
    self._xp_jsonld(document))
  File "/usr/local/lib/python3.7/site-packages/extruct/jsonld.py", line 26, in <listcomp>
    for item in items
TypeError: 'NoneType' object is not iterable

The code is:
data = extruct.extract(r.text, base_url=base_url,syntaxes=['json-ld', 'opengraph'],uniform=True)
The URL being passed in is https://www.tasteofhome.com/collection/keto-diet-recipes/view-all/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions