bugfixing

This commit is contained in:
MuslemRahimi 2025-01-10 18:34:13 +01:00
parent 907ef0545b
commit 1f312deae2

View File

@ -8,16 +8,14 @@ load_dotenv()
api_key = os.getenv('FMP_API_KEY') api_key = os.getenv('FMP_API_KEY')
headers = {"accept": "application/json"}
def filter_and_deduplicate(data,deduplicate_key='title'): def filter_and_deduplicate(data,deduplicate_key='title'):
seen_keys = set() seen_keys = set()
filtered_data = [] filtered_data = []
excluded_domains = ['accesswire.com']
for item in data: for item in data:
if not any(domain in item['url'] for domain in excluded_domains):
key = item.get(deduplicate_key) key = item.get(deduplicate_key)
if key and key not in seen_keys: if key and key not in seen_keys:
filtered_data.append(item) filtered_data.append(item)