Add1E commited on
Commit
7af931a
·
verified ·
1 Parent(s): 7d8a0ef

Update trend_crawl.py

Browse files
Files changed (1) hide show
  1. 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
- if datetime.now() - convert_to_datetime(trend.started_timestamp[0]) > timedelta(days=2):
33
- continue
 
 
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: