dlflannery commited on
Commit
e3d7397
·
verified ·
1 Parent(s): c50b9aa

Update app.py

Browse files

Including hostname (as source) and age in brave news context

Files changed (1) hide show
  1. app.py +11 -2
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
- continue
92
- rv += ' ** '
 
 
 
 
 
 
 
 
 
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