I'm using the feedparser python library to pull RSS data from a feed continuously. I've written my python code in such a way that I can ask for a single instance of the RSS data. Here's my code currently:
import feedparser
rssPR = feedparser.parse('http://www.prnewswire.co.uk/rss/consumer-technology/wireless- communications-news.rss')
rssDataList = []
for index, item in enumerate(rssPR.entries):
rssDataList.append([item.published.encode('utf-8'), item.title.encode('utf-8')])
print rssDataList[0] #for debugging purposes
print rssPR.modified #for testing purposes
What can I add to my code so that it will only check for new RSS data if and only if the RSS has been modified?
Let's say I have a list of 10 RSS items, and the RSS feed has been updated with 2 new RSS items. How can I only add those 2 items to the rssDataList I've created? I don't want to keep adding the same RSSs to my database.
etag
norLast-Modified
exists? – Whisenhunt