lalithadevi
commited on
Update news_extractor/news_extractor.py
Browse files
news_extractor/news_extractor.py
CHANGED
@@ -40,10 +40,10 @@ def rss_parser(i):
|
|
40 |
"""
|
41 |
try:
|
42 |
b1 = BeautifulSoup(str(i), "xml")
|
43 |
-
title = "" if b1.find("title") is None else b1.find("title").get_text()
|
44 |
title = text_clean(title)
|
45 |
-
url = "" if b1.find("link") is None else b1.find("link").get_text()
|
46 |
-
desc = "" if b1.find("description") is None else b1.find("description").get_text()
|
47 |
desc = text_clean(desc)
|
48 |
desc = f'{desc[:300]}...' if len(desc) >= 300 else desc
|
49 |
date = "Sat, 12 Aug 2000 13:39:15 +05:30" if ((b1.find("pubDate") == "") or (b1.find("pubDate") is None)) else b1.find("pubDate").get_text()
|
|
|
40 |
"""
|
41 |
try:
|
42 |
b1 = BeautifulSoup(str(i), "xml")
|
43 |
+
title = "" if b1.find("title") is None else b1.find("title").get_text().strip()
|
44 |
title = text_clean(title)
|
45 |
+
url = "" if b1.find("link") is None else b1.find("link").get_text().strip()
|
46 |
+
desc = "" if b1.find("description") is None else b1.find("description").get_text().strip()
|
47 |
desc = text_clean(desc)
|
48 |
desc = f'{desc[:300]}...' if len(desc) >= 300 else desc
|
49 |
date = "Sat, 12 Aug 2000 13:39:15 +05:30" if ((b1.find("pubDate") == "") or (b1.find("pubDate") is None)) else b1.find("pubDate").get_text()
|