Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -359,18 +359,36 @@ def find_rss():
|
|
359 |
try:
|
360 |
#print(lod['rss']['channel']['item'][0].keys())
|
361 |
#print(lod['rss'].keys())
|
|
|
|
|
|
|
|
|
362 |
for i,ea in enumerate(lod['rss']['channel']['item']):
|
363 |
try:
|
364 |
r_link = ea['link']
|
365 |
-
|
366 |
-
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
except Exception:
|
369 |
print(f"Exception::{ea}")
|
370 |
try:
|
371 |
r_link = ea['link']
|
372 |
r_title = ea['source']
|
373 |
-
|
|
|
|
|
374 |
lods = {"title":r_title, "description":r_description,"link":r_link}
|
375 |
except Exception as e:
|
376 |
error_box.append({"Name":rss_url,"Error":e,"Error Code":4})
|
|
|
359 |
try:
|
360 |
#print(lod['rss']['channel']['item'][0].keys())
|
361 |
#print(lod['rss'].keys())
|
362 |
+
print("##############")
|
363 |
+
print(lod.keys())
|
364 |
+
print("##############")
|
365 |
+
|
366 |
for i,ea in enumerate(lod['rss']['channel']['item']):
|
367 |
try:
|
368 |
r_link = ea['link']
|
369 |
+
if ea.get('title') != None:
|
370 |
+
r_title = ea['title']
|
371 |
+
else: r_title= ea['source']
|
372 |
+
tt = TextBlob(r_title)
|
373 |
+
tt_nouns=tt.tags
|
374 |
+
tt_phrases=tt.noun_phrases
|
375 |
+
if ea.get('description') != None:
|
376 |
+
r_description = ea['description']
|
377 |
+
else: r_description = 'No Description'
|
378 |
+
td = TextBlob(r_description)
|
379 |
+
td_nouns=td.tags
|
380 |
+
td_phrases=td.noun_phrases
|
381 |
+
nouns=tt_nouns+td_nouns
|
382 |
+
phrases=tt_phrases+td_phrases
|
383 |
+
lods = {"title":r_title, "description":r_description,"link":r_link, "nouns":nouns, "noun_phrases":phrases}
|
384 |
except Exception:
|
385 |
print(f"Exception::{ea}")
|
386 |
try:
|
387 |
r_link = ea['link']
|
388 |
r_title = ea['source']
|
389 |
+
|
390 |
+
if ea.get('description')
|
391 |
+
r_description = ea['description']
|
392 |
lods = {"title":r_title, "description":r_description,"link":r_link}
|
393 |
except Exception as e:
|
394 |
error_box.append({"Name":rss_url,"Error":e,"Error Code":4})
|