RSS-Bridge / rss-bridge

The RSS feed for websites missing it
https://rss-bridge.org/bridge01/
The Unlicense
7.18k stars 1.02k forks source link

CLI parameter to limit fetched articles by date #2009

Open hejops opened 3 years ago

hejops commented 3 years ago

Is your feature request related to a problem? Please describe. Not sure whether such a feature already exists, but I think it would be nice to have a CLI parameter to limit fetched articles by date, instead of just fetching a fixed number of articles.

Describe the solution you'd like To fetch articles posted within the last 7 days: php index.php action=display bridge=Bandcamp band=theflenser newerthan=7 format=Json

Describe alternatives you've considered You can filter after fetching a feed using jq's fromdate function:

< test.json jq -r '.items[] | select (.date_modified | . == null or fromdate > seconds)'

However, time zones must first be corrected, since the time zone format (+00:00) produced by rss-bridge is not fully ISO 8601 compliant (Z).

Additional context The idea behind this is mainly to mimic newsboat's keep-articles-days config: https://github.com/newsboat/newsboat/blob/840d59f75e05b21fc3d59470fbed29ff9a17914f/src/cache.cpp#L1089

em92 commented 3 years ago

However, time zones must first be corrected, since the time zone format (+00:00) produced by rss-bridge is not fully ISO 8601 compliant (Z).

Workaround for this:

php index.php action=display bridge=Bandcamp band=theflenser format=Json | sed "/date_modified/s/+00:00/Z/"
dvikan commented 2 years ago

@hejops This is doable but require work in all the format factories.