Skip to content

Commit cf29e25

Browse files
committed
feat(AlgoliaAPI): validate height, weight, and endowment before assignment in to_scraped_performer
Signed-off-by: xantror <69341873+xantror@users.noreply.github.com>
1 parent b98a099 commit cf29e25

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

scrapers/AlgoliaAPI/AlgoliaAPI.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,14 @@ def to_scraped_performer(performer_from_api: dict[str, Any], site: str) -> Scrap
191191
if alternate_names := dig(performer_from_api, "attributes", "alternate_names"):
192192
performer["aliases"] = alternate_names.strip()
193193
if height := dig(performer_from_api, "attributes", "height"):
194-
performer["height"] = feet_to_cm(height.strip())
194+
if (cm := feet_to_cm(height.strip())) and int(cm) > 0:
195+
performer["height"] = cm
195196
if weight := dig(performer_from_api, "attributes", "weight"):
196-
performer["weight"] = lb_to_kg(weight.strip())
197+
if (kg := lb_to_kg(weight.strip())) and int(kg) > 0:
198+
performer["weight"] = kg
197199
if endowment := dig(performer_from_api, "attributes", "endowment"):
198-
performer["penis_length"] = feet_to_cm("0'" + endowment.strip())
200+
if (cm := feet_to_cm("0'" + endowment.strip())) and int(cm) > 0:
201+
performer["penis_length"] = cm
199202
if home := dig(performer_from_api, "attributes", "home"):
200203
performer["country"] = guess_nationality(home.strip())
201204
if performer_from_api.get("has_pictures") and (pictures := performer_from_api.get("pictures")):

0 commit comments

Comments
 (0)