mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 18:41:50 +01:00
fix: take care of changed belen_conf keys (#758)
## ℹ️ Description This PR takes care of the changed belen_conf dictionary. So extracting special attributes and third category will work again. - Link to the related issue(s): Issue #757 ## 📋 Changes Summary - changed belen_conf keys from "dimension108" to "ad_attributes" and "dimension92" to "l3_category_id" ### ⚙️ Type of Change Select the type(s) of change(s) included in this pull request: - [x] 🐞 Bug fix (non-breaking change which fixes an issue) - [ ] ✨ New feature (adds new functionality without breaking existing usage) - [ ] 💥 Breaking change (changes that might break existing user setups, scripts, or configurations) ## ✅ Checklist Before requesting a review, confirm the following: - [x] I have reviewed my changes to ensure they meet the project's standards. - [x] I have tested my changes and ensured that all tests pass (`pdm run test`). - [x] I have formatted the code (`pdm run format`). - [x] I have verified that linting passes (`pdm run lint`). - [x] I have updated documentation where necessary. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated internal data extraction sources for category and attribute information to align with current analytics configuration. * Updated test suite to reflect configuration changes. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Jens <1742418+1cu@users.noreply.github.com>
This commit is contained in:
@@ -325,10 +325,10 @@ class AdExtractor(WebScrapingMixin):
|
||||
info["category"] = await self._extract_category_from_ad_page()
|
||||
|
||||
# append subcategory and change e.g. category "161/172" to "161/172/lautsprecher_kopfhoerer"
|
||||
# take subcategory from dimension92 as key 'art_s' sometimes is a special attribute (e.g. gender for clothes)
|
||||
# take subcategory from third_category_name as key 'art_s' sometimes is a special attribute (e.g. gender for clothes)
|
||||
# the subcategory isn't really necessary, but when set, the appropriate special attribute gets preselected
|
||||
if dimension92 := belen_conf["universalAnalyticsOpts"]["dimensions"].get("dimension92"):
|
||||
info["category"] += f"/{dimension92}"
|
||||
if third_category_id := belen_conf["universalAnalyticsOpts"]["dimensions"].get("l3_category_id"):
|
||||
info["category"] += f"/{third_category_id}"
|
||||
|
||||
info["title"] = title
|
||||
|
||||
@@ -498,7 +498,7 @@ class AdExtractor(WebScrapingMixin):
|
||||
"""
|
||||
|
||||
# e.g. "art_s:lautsprecher_kopfhoerer|condition_s:like_new|versand_s:t"
|
||||
special_attributes_str = belen_conf["universalAnalyticsOpts"]["dimensions"].get("dimension108")
|
||||
special_attributes_str = belen_conf["universalAnalyticsOpts"]["dimensions"].get("ad_attributes")
|
||||
if not special_attributes_str:
|
||||
return {}
|
||||
special_attributes = dict(item.split(":") for item in special_attributes_str.split("|") if ":" in item)
|
||||
|
||||
Reference in New Issue
Block a user