Spaces:
Running
Running
Update app.py
Browse filesIncluding hostname (as source) and age in brave news context
app.py
CHANGED
@@ -88,8 +88,17 @@ def get_brave_news(query: str, interval: str = 'pd'):
|
|
88 |
for snip in item['extra_snippets']:
|
89 |
rv += (snip + ' ')
|
90 |
except:
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
return rv
|
95 |
|
|
|
88 |
for snip in item['extra_snippets']:
|
89 |
rv += (snip + ' ')
|
90 |
except:
|
91 |
+
pass
|
92 |
+
try:
|
93 |
+
host = item['meta_url']['hostname']
|
94 |
+
except:
|
95 |
+
host = 'unknown'
|
96 |
+
try:
|
97 |
+
age = item['age']
|
98 |
+
except:
|
99 |
+
age = 'unknown'
|
100 |
+
rv += f' (Item source: {host}, Item age: {age})'
|
101 |
+
rv += ' *item separator* '
|
102 |
|
103 |
return rv
|
104 |
|