Spaces:
Running
Running
Update trend_crawl.py
Browse files- trend_crawl.py +4 -2
trend_crawl.py
CHANGED
@@ -29,8 +29,10 @@ def process_trends_for_country(country_code, trends_list):
|
|
29 |
if country_code not in trends_json:
|
30 |
trends_json[country_code] = {"All categories" : {}}
|
31 |
for trend in trends_list:
|
32 |
-
|
33 |
-
|
|
|
|
|
34 |
category = None
|
35 |
for topic_id in trend.topics:
|
36 |
if topic_id in TREND_TOPICS:
|
|
|
29 |
if country_code not in trends_json:
|
30 |
trends_json[country_code] = {"All categories" : {}}
|
31 |
for trend in trends_list:
|
32 |
+
timestamp = convert_to_datetime(trend.started_timestamp[0])
|
33 |
+
current_time = datetime.now(timezone.utc)
|
34 |
+
if current_time - timestamp > timedelta(days=2):
|
35 |
+
continue
|
36 |
category = None
|
37 |
for topic_id in trend.topics:
|
38 |
if topic_id in TREND_TOPICS:
|