-
Notifications
You must be signed in to change notification settings - Fork 2
/
newsfeed.py
42 lines (34 loc) · 937 Bytes
/
newsfeed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
-*- coding: utf-8 -*-
========================
Python Desktop News Notifier
========================
Developed by: Chirag Rathod (Srce Cde)
Email: [email protected]
========================
"""
import feedparser
import notify2
import time
import os
def Parsefeed():
f = feedparser.parse("http://feeds.bbci.co.uk/news/rss.xml")
ICON_PATH = os.getcwd() + "/icon.ico"
notify2.init('News Notify')
for newsitem in f['items']:
print(newsitem['title'])
print(newsitem['summary'])
print('\n')
n = notify2.Notification(newsitem['title'],
newsitem['summary'],
icon=ICON_PATH
)
n.set_urgency(notify2.URGENCY_NORMAL)
n.show()
n.set_timeout(15000)
time.sleep(1200)
if __name__ == '__main__':
try:
Parsefeed()
except:
print("Error")