Spaces:
Running
Running
Update trend_crawl.py
Browse files- trend_crawl.py +3 -2
trend_crawl.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
from trendspy import Trends
|
2 |
import streamlit as st
|
3 |
from datetime import datetime, timezone
|
4 |
-
tr = Trends()
|
5 |
|
6 |
TREND_TOPICS = {
|
7 |
1: "Autos and Vehicles",
|
@@ -24,7 +23,7 @@ TREND_TOPICS = {
|
|
24 |
18: "Technology",
|
25 |
19: "Travel and Transportation"
|
26 |
}
|
27 |
-
|
28 |
def process_trends_for_country(country_code, trends_list):
|
29 |
if country_code not in trends_json:
|
30 |
trends_json[country_code] = {"All categories" : {}}
|
@@ -67,6 +66,8 @@ def convert_to_datetime( raw_time):
|
|
67 |
return datetime.fromtimestamp(raw_time, tz=timezone.utc) if raw_time else None
|
68 |
|
69 |
def get_trends(countries: list):
|
|
|
|
|
70 |
for country in countries:
|
71 |
trends = tr.trending_now(geo=country)
|
72 |
|
|
|
1 |
from trendspy import Trends
|
2 |
import streamlit as st
|
3 |
from datetime import datetime, timezone
|
|
|
4 |
|
5 |
TREND_TOPICS = {
|
6 |
1: "Autos and Vehicles",
|
|
|
23 |
18: "Technology",
|
24 |
19: "Travel and Transportation"
|
25 |
}
|
26 |
+
|
27 |
def process_trends_for_country(country_code, trends_list):
|
28 |
if country_code not in trends_json:
|
29 |
trends_json[country_code] = {"All categories" : {}}
|
|
|
66 |
return datetime.fromtimestamp(raw_time, tz=timezone.utc) if raw_time else None
|
67 |
|
68 |
def get_trends(countries: list):
|
69 |
+
tr = Trends()
|
70 |
+
trends_json = {}
|
71 |
for country in countries:
|
72 |
trends = tr.trending_now(geo=country)
|
73 |
|