@@ -236,6 +236,10 @@ async def _extract_ad_page_info(self, directory:str, ad_id:int) -> dict[str, Any
236236 .removeprefix ((self .config ["ad_defaults" ]["description" ]["prefix" ] or "" ).strip ()) \
237237 .removesuffix ((self .config ["ad_defaults" ]["description" ]["suffix" ] or "" ).strip ())
238238 info ['special_attributes' ] = await self ._extract_special_attributes_from_ad_page ()
239+ if "art_s" in info ['special_attributes' ]:
240+ # change e.g. category "161/172" to "161/172/lautsprecher_kopfhoerer"
241+ info ['category' ] = f"{ info ['category' ]} /{ info ['special_attributes' ]['art_s' ]} "
242+ del info ['special_attributes' ]['art_s' ]
239243 info ['price' ], info ['price_type' ] = await self ._extract_pricing_info_from_ad_page ()
240244 info ['shipping_type' ], info ['shipping_costs' ], info ['shipping_options' ] = await self ._extract_shipping_info_from_ad_page ()
241245 info ['sell_directly' ] = await self ._extract_sell_directly_from_ad_page ()
@@ -282,7 +286,10 @@ async def _extract_special_attributes_from_ad_page(self) -> dict[str, Any]:
282286 :return: a dictionary (possibly empty) where the keys are the attribute names, mapped to their values
283287 """
284288 belen_conf = await self .web_execute ("window.BelenConf" )
289+
290+ # e.g. "art_s:lautsprecher_kopfhoerer|condition_s:like_new|versand_s:t"
285291 special_attributes_str = belen_conf ["universalAnalyticsOpts" ]["dimensions" ]["dimension108" ]
292+
286293 special_attributes = dict (item .split (":" ) for item in special_attributes_str .split ("|" ) if ":" in item )
287294 special_attributes = {k : v for k , v in special_attributes .items () if not k .endswith ('.versand_s' ) and k != "versand_s" }
288295 return special_attributes
0 commit comments