Skip to content

Commit b98a099

Browse files
committed
feat(AlgoliaAPI): add endowment directly in to_scraped_performer
Signed-off-by: xantror <[email protected]>
1 parent bf026e4 commit b98a099

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

scrapers/AlgoliaAPI/AlgoliaAPI.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,6 @@ def scene_url(site: str, sitename: str, url_title: str, clip_id: str) -> str:
173173
"Generates URL for a scene"
174174
return f"{homepage_url(site.lower())}/en/video/{sitename.lower()}/{url_title}/{clip_id}"
175175

176-
def parse_endowment(performer_from_api: dict[str, Any], gender: str | None) -> dict[str, Any] | None:
177-
"Parses penis length if gender is male"
178-
if (
179-
gender == "male"
180-
and (endowment := dig(performer_from_api, "attributes", "endowment"))
181-
):
182-
return {"penis_length": feet_to_cm("0'" + endowment.strip())}
183-
return None
184-
185176
def to_scraped_performer(performer_from_api: dict[str, Any], site: str) -> ScrapedPerformer:
186177
"Helper function to convert from Algolia's API to Stash's scraper return type"
187178
performer: ScrapedPerformer = {}
@@ -203,8 +194,8 @@ def to_scraped_performer(performer_from_api: dict[str, Any], site: str) -> Scrap
203194
performer["height"] = feet_to_cm(height.strip())
204195
if weight := dig(performer_from_api, "attributes", "weight"):
205196
performer["weight"] = lb_to_kg(weight.strip())
206-
if endowment := parse_endowment(performer_from_api, performer.get("gender")):
207-
performer.update(endowment)
197+
if endowment := dig(performer_from_api, "attributes", "endowment"):
198+
performer["penis_length"] = feet_to_cm("0'" + endowment.strip())
208199
if home := dig(performer_from_api, "attributes", "home"):
209200
performer["country"] = guess_nationality(home.strip())
210201
if performer_from_api.get("has_pictures") and (pictures := performer_from_api.get("pictures")):

0 commit comments

Comments
 (0)