0

Basically this is my code but what it does is loop through all the post.

d = feedparser.parse('www.reddit.com/r/Python/.rss')

for post in d:
    print post.title

What I'm trying to accomplish is to have it loop only between a specifed date.

For example: display the posts between April 15, 2015 and April 16, 2015.

lozadaOmr
  • 2,565
  • 5
  • 44
  • 58

1 Answers1

0

I haven't been able to find any way of providing a query parameter specifying date interval, so I'm afraid you'll have to retrieve all entries and filter them by date afterwards:

import feedparser
d = feedparser.parse('http://www.reddit.com/r/Python/.rss')
for entry in d.entries:
  date = entry.published_parsed
  if date.tm_year == 2015 and date.tm_mon == 4 and date.tm_mday >= 15 and date.tm_mday <= 16:
    print entry.title
EvenLisle
  • 4,672
  • 3
  • 24
  • 47