7777}
7878
7979
80+ def feetinches_to_cm (feet , inches ):
81+ return str (round ((float (feet ) * 12 + float (inches )) * 2.54 ))
82+
83+
84+ def lbs_to_kg (lbs ):
85+ return str (round (float (lbs ) / 2.2046 ))
86+
87+
8088def clean_url (url : str ) -> str :
8189 # remove any query parameters
8290 return re .sub (r"\?.*" , "" , url )
@@ -168,8 +176,8 @@ def get_studio(site: str) -> ScrapedStudio:
168176
169177def to_scraped_performer (raw_performer : dict ) -> ScrapedPerformer :
170178 # Convert dict keys to lower case because, of couse, they can come in differently depending on studio.
171- raw_performer = {key .lower ():value for key ,value in raw_performer .items ()}
172-
179+ raw_performer = {key .lower (): value for key , value in raw_performer .items ()}
180+
173181 # Studios that do not use units for measurements, but are obviously not metric.
174182 STUDIO_USES_IMPERIAL = [
175183 "joeschmoevideos.com" ,
@@ -179,15 +187,17 @@ def to_scraped_performer(raw_performer: dict) -> ScrapedPerformer:
179187 performer : ScrapedPerformer = {
180188 "name" : raw_performer ["name" ],
181189 "gender" : raw_performer ["gender" ],
182- "url" : make_performer_url (raw_performer ["slug" ], raw_performer ["site_domain" ]),
190+ "urls" : [
191+ make_performer_url (raw_performer ["slug" ], raw_performer ["site_domain" ])
192+ ],
183193 "tags" : [],
184194 }
185195
186196 if image := raw_performer .get ("thumb" ):
187- performer ["image " ] = image
197+ performer ["images " ] = [ image ]
188198 elif image := raw_performer .get ("thumbnail" ):
189- image = re .sub (r' ^//' , ' https://' , image )
190- performer ["image " ] = image
199+ image = re .sub (r" ^//" , " https://" , image )
200+ performer ["images " ] = [ image ]
191201
192202 if bio := raw_performer .get ("bio" ):
193203 performer ["details" ] = strip_tags (bio )
@@ -209,7 +219,7 @@ def to_scraped_performer(raw_performer: dict) -> ScrapedPerformer:
209219 if (height_ft := raw_performer .get ("height" )) and (
210220 h := re .match (r"(\d+)\D+(\d+).+" , height_ft )
211221 ):
212- height_cm = feetinches_to_cm (h .group (1 ),h .group (2 ))
222+ height_cm = feetinches_to_cm (h .group (1 ), h .group (2 ))
213223 performer ["height" ] = str (height_cm )
214224 elif (height_m := raw_performer .get ("height" )) and (
215225 h := re .match (r"^(\d\.\d\d)$" , height_m )
@@ -234,12 +244,20 @@ def to_scraped_performer(raw_performer: dict) -> ScrapedPerformer:
234244 elif (weight_nounits := raw_performer .get ("weight" )) and (
235245 w := re .match (r"^([\d\.]+)$" , weight_nounits )
236246 ):
237- performer ["weight" ] = lbs_to_kg (w .group (1 )) if raw_performer ["site_domain" ] in STUDIO_USES_IMPERIAL else str (w .group (1 ))
247+ performer ["weight" ] = (
248+ lbs_to_kg (w .group (1 ))
249+ if raw_performer ["site_domain" ] in STUDIO_USES_IMPERIAL
250+ else str (w .group (1 ))
251+ )
238252
239- if (penis_nounits := raw_performer .get ("dick size" )) and (
253+ if (penis_nounits := raw_performer .get ("dick size" )) and (
240254 s := re .match (r"^([\d\.]+)$" , penis_nounits )
241255 ):
242- performer ["penis_length" ] = feetinches_to_cm (0 ,s .group (1 )) if raw_performer ["site_domain" ] in STUDIO_USES_IMPERIAL else str (s .group (1 ))
256+ performer ["penis_length" ] = (
257+ feetinches_to_cm (0 , s .group (1 ))
258+ if raw_performer ["site_domain" ] in STUDIO_USES_IMPERIAL
259+ else str (s .group (1 ))
260+ )
243261
244262 if circumcised := raw_performer .get ("cut / uncut" ):
245263 performer ["circumcised" ] = circumcised .capitalize ()
@@ -309,7 +327,7 @@ def to_scraped_scene_from_content(raw_scene: dict) -> ScrapedScene:
309327 {
310328 "name" : x ["name" ],
311329 "image" : x ["thumb" ],
312- "url " : make_performer_url (x ["slug" ], site ),
330+ "urls " : [ make_performer_url (x ["slug" ], site )] ,
313331 }
314332 for x in models
315333 ]
@@ -404,14 +422,6 @@ def scrape_performer(url: str) -> ScrapedPerformer | None:
404422 return to_scraped_performer (props ["model" ])
405423
406424
407- def feetinches_to_cm (feet ,inches ):
408- return (str (round ((float (feet ) * 12 + float (inches )) * 2.54 )))
409-
410-
411- def lbs_to_kg (lbs ):
412- return (str (round (float (lbs ) / 2.2046 )))
413-
414-
415425if __name__ == "__main__" :
416426 op , args = scraper_args ()
417427
@@ -426,4 +436,5 @@ def lbs_to_kg(lbs):
426436 sys .exit (1 )
427437
428438 result = replace_all (result , "url" , fix_url ) # type: ignore
439+ result = replace_all (result , "urls" , fix_url ) # type: ignore
429440 print (json .dumps (result ))
0 commit comments