Skip to content

Commit

Permalink
Solve issues caught by mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Jan 17, 2025
1 parent f0c4056 commit 4101f8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zyte_spider_templates/spiders/serp.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ def parse_serp(
self.args.results_per_page or self._default_results_per_page
)
if serp.organicResults and (
serp.metadata.totalOrganicResults is None
serp.metadata is None
or serp.metadata.totalOrganicResults is None
or serp.metadata.totalOrganicResults > next_start
):
next_url = add_or_replace_parameter(serp.url, "start", str(next_start))
Expand All @@ -358,7 +359,7 @@ def parse_serp(
yield serp
return

for result in serp.organicResults:
for result in serp.organicResults or []:
inject: list[type] = [ITEM_TYPE_CLASSES[self.args.item_type]]
if self._custom_attrs_dep:
inject.append(self._custom_attrs_dep) # type: ignore[arg-type]
Expand Down

0 comments on commit 4101f8a

Please sign in to comment.