0

I need to fetch the last 3 feeds from a feed url and display. The code that i'm currently using is :

import feedparser

feedUrl = ""

feed = feedparser.parse( feedUrl )

length = len(feed['entries']) 
stop =  (length-4) if length > 3 else -1

for i in range(length-1, stop, -1):
    print feed['items'][i]['title'] + " " + feed['items'][i]['link']

Is there a way using ETags and/or Last-Modified headers to accomplish this?

Dhruv
  • 1,079
  • 2
  • 13
  • 26

1 Answers1

0

Unfortunately, no, I don't think there is any feed publisher which uses HTTP level features (like Etags or Last-Modified) inside the feed themselves. In theory that would work, but since that would probably not be standard in any way and not implemented by everyone, you'll probably end up having to create a fallback mechanism anyway.

The only similar solution I can think of is using a service like Superfeedr which has a retrieve feature usable with both a before and after query string to get entries published before or after a given entry.

Julien Genestoux
  • 31,046
  • 20
  • 66
  • 93