0

how do I download only the specific attribute of a metadata of an rss? I'm using the universal feedparser library

feedparser.parse(linkstr).entries[0].published

I have this line, which returns something like this if printed: "Sat, 02 Dec 2017 07:00:34 Z"

My question is, does the line download the entire feed and then post only the pubdate of the first entry? Or does it download only the pubdate?

If the former, how can I download only the specific attribute? This is for a bot that runs a check every five minutes, so downloading an entire feed every five minutes will just be unfeasible and horribly inefficient

xland44
  • 9
  • 5

1 Answers1

0

Why don't you use e-tag/last-modified headers?

https://pythonhosted.org/feedparser/http-etag.html

Georgios Moralis
  • 189
  • 1
  • 11
  • Thanks, but again - is there any real difference between: feedparser.parse(linkstr).entries[0].published_parsed or feedparser.parse(linkstr).modified_parsed ? second example is what is given in the link you provided – xland44 Dec 02 '17 at 11:46
  • When using e-tag and/or last-modified headers, the client checks for changes from previous cashed requests, thus it will not download again the RSS feed if there is no change in these headers. As it is saying in the documentation, you should better include both last-modified and e-tag headers since it depends on the server which one of the is supported. In your example you actually download the RSS feed and you are checking the entries, while you can avoid downloading the feed with the e-tag/last-modified header method. – Georgios Moralis Dec 02 '17 at 12:02