add abstraction ob platform and article + vinted

"

Signed-off-by: Omar Sánchez Pizarro <omar.sanchez@pistacero.net>
This commit is contained in:
Omar Sánchez Pizarro
2025-10-10 14:58:27 +02:00
parent b5178f415b
commit 4111f57564
16 changed files with 1890 additions and 102 deletions

View File

@@ -1,9 +1,9 @@
class ItemMonitor:
def __init__(self, name,search_query, latitude, longitude, max_distance,
def __init__(self, name, search_query, latitude, longitude, max_distance,
condition, min_price, max_price, title_exclude,
description_exclude, title_must_include, description_must_include,
title_first_word_exclude, check_every, thread_id):
title_first_word_exclude, check_every, thread_id, platform, country):
self._name = name
self._search_query = search_query
self._latitude = latitude
@@ -19,6 +19,8 @@ class ItemMonitor:
self._title_first_word_exclude = title_first_word_exclude
self._check_every = check_every
self._thread_id = thread_id
self._platform = platform
self._country = country
@classmethod
def load_from_json(cls, json_data):
# search_query is mandatory
@@ -40,7 +42,9 @@ class ItemMonitor:
json_data.get('description_must_include', []),
json_data.get('title_first_word_exclude', []),
json_data.get('check_every', 30),
json_data.get('thread_id', 1)
json_data.get('thread_id', 1),
json_data.get('platform', 'wallapop'), # Default to wallapop for backward compatibility
json_data.get('country', 'es') # Default country for platforms that support it (Vinted, etc.)
)
def get_name(self):
@@ -86,4 +90,10 @@ class ItemMonitor:
return self._check_every
def get_thread_id(self):
return self._thread_id
return self._thread_id
def get_platform(self):
return self._platform
def get_country(self):
return self._country