File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -250,8 +250,13 @@ for feed_url in feed_urls:
250
250
251
251
new_hashes = [] # type: List[str]
252
252
data = feedparser .parse (feed_url ) # type: feedparser.parse
253
+ entries = data .entries
254
+ if not old_feed_hashes :
255
+ # On a first run, pick up the 3 most recent entries. An RSS feed has
256
+ # entries in reverse chronological order.
257
+ entries = entries [:3 ]
253
258
254
- for entry in data . entries :
259
+ for entry in reversed ( entries ) :
255
260
entry_hash = compute_entry_hash (entry ) # type: str
256
261
# An entry has either been published or updated.
257
262
entry_time = entry .get (
@@ -265,12 +270,8 @@ for feed_url in feed_urls:
265
270
# entries older than some threshold.
266
271
continue
267
272
if entry_hash in old_feed_hashes :
268
- # We've already seen this. No need to process any older entries.
269
- break
270
- if (not old_feed_hashes ) and (len (new_hashes ) >= 3 ):
271
- # On a first run, pick up the 3 most recent entries. An RSS feed has
272
- # entries in reverse chronological order.
273
- break
273
+ # We've already seen this.
274
+ continue
274
275
275
276
feed_name = data .feed .title or feed_url # type: str
276
277
You can’t perform that action at this time.
0 commit comments