Aug-03-2018, 11:50 AM
Hi,
I'm still new to Python and I'm playing around with an RSS reader.
The code actually works so far so I'm very proud of myself
The code below reads ONE rss feed and matches it against keywords and based on that it perfoms an action.
The only thing is, it only reads ONE rss feed and I would like to let it read more than ONE feed.
So I thought that I could change:
What would be the easiest way to achieve this?
Original and full code:
I'm still new to Python and I'm playing around with an RSS reader.
The code actually works so far so I'm very proud of myself

The code below reads ONE rss feed and matches it against keywords and based on that it perfoms an action.
The only thing is, it only reads ONE rss feed and I would like to let it read more than ONE feed.
So I thought that I could change:
d = feedparser.parse('https://feed1.rss')into:
d = feedparser.parse('https://feed1.rss','https://feed2.rss')But that doesn't seem to work.
What would be the easiest way to achieve this?
Original and full code:
#!/usr/bin/python import feedparser import os import time # Reset old_message old_message = "" # Reset flag flag = 0 while True: # Whipe screen os.system('clear') # Read RSS Feed d = feedparser.parse('https://feed1.rss') # Gather title title = d['entries'][0]['title'] # Title to uppercase title = title.upper() # Gather description description = d['entries'][0]['description'] # Description to uppercase description = description.upper() # Combine title and description to message message = title + " " + description # Conditions need to be in capitals if message.find("56") != -1: flag = 1 if message.find("HO") != -1: flag = 1 # If flag = true if flag == 1: if message != old_message: print("\033[1;31;40m *** ALERT ***") old_message = message print title print description print flag flag = 0 print("\033[1;32;40m") time.sleep(10)