-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss2.py
More file actions
17 lines (15 loc) · 740 Bytes
/
rss2.py
File metadata and controls
17 lines (15 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import feedparser
from re import sub
def ReadNews():
try:
NewsFeed = feedparser.parse("https://www.tagesschau.de/xml/rss2_https/")
#NewsText = NewsFeed.entries[0].title+": "+NewsFeed.entries[0].content[1].value # alt
NewsText = NewsFeed.entries[0].title+": "+NewsFeed.entries[0].description
chars = {'ö':'oe','ä':'ae','ü':'ue','Ö':'Oe','Ä':'Ae','Ü':'Ue','ß':'ss','–':'-',' ':' ','§':'Paragraph'}
for char in chars:
NewsText = NewsText.replace(char,chars[char])
except:
NewsText = "Keine Tagesschau News ???"
return sub('[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890()?=/.%&:!, -]', ' ', NewsText)
NewsText = ReadNews();
print(NewsText);