shouya / rss-funnel

Self-hosted RSS multi-tool
https://rss-funnel-demo.fly.dev
GNU General Public License v3.0
108 stars 4 forks source link

Limit source feed but not all feed #107

Closed Vctrsnts closed 5 months ago

Vctrsnts commented 5 months ago

Hello good.

Thank you very much for all the work you have done, but I am facing a problem that I am wondering if you can help me with. What I want to do is that from each RSS (source) I take the first 100 feeds and put them in the final feed:

endpoints:
  - path: /rss_feed.xml
    source:
      format: rss
      title: Mi rss_feed de Podcasts que sigo. Entre ellos estan Atareao, uGeek, FrenteAlCliente, PapaFriki y muchos mas.
    filters:
      - merge:
          source:
            - https://anchor.fm/s/5a5b39c/podcast/rss
            - https://anchor.fm/s/81022ad4/podcast/rss
            - https://anchor.fm/s/1218850/podcast/rss
            - https://feeds.redcircle.com/610e9ea8-edf0-407f-9e6c-72375a0e17db
            - https://anchor.fm/s/115eb3dc/podcast/rss
            - http://feeds.feedburner.com/papafriki
            - https://podcastlinux.com/feed
            - https://anchor.fm/s/baa8920/podcast/rss
            - https://ugeek.github.io/podcast.xml
      - js: |
          function modify_post(feed, post) {
            post.description = null;
            post.content = null;
            post.author = null;
            post.categories = [];
            post.comments = null;
            post.link = null;
            post.guid = null;
            post.source = null;
            post.extensions = {};
            post.itunes_ext = null;
            post.namespaces = {};
            post.dublin_core_ext = null;

            return  post;
          }
      - modify_feed: feed.items = feed.items.slice(0, 100); 

I have tried adding, as you can see, the slice(0, 100), but what it does is generate a feed with 100 items. To give an example, if in the source I have 10 rss and a limit of 100 feeds, I would have to create an rss_feed.xml with 1000 feeds and not as it does now, which only creates a feed of 100.

This is possible

Thank you

shouya commented 5 months ago

If you want to apply the slice(0, 100) to each of the merged feed, you should add it INSIDE the merge's filters field. In addition, you can now simply use the limit filter instead of modify_feed: slice... if you're using the nightly image.

  - path: /rss_feed.xml
    source:
      format: rss
      title: Mi rss_feed de Podcasts que sigo. Entre ellos estan Atareao, uGeek, FrenteAlCliente, PapaFriki y muchos mas.
    filters:
      - merge:
          source:
            - https://anchor.fm/s/5a5b39c/podcast/rss
            - https://anchor.fm/s/81022ad4/podcast/rss
            - https://anchor.fm/s/1218850/podcast/rss
            - https://feeds.redcircle.com/610e9ea8-edf0-407f-9e6c-72375a0e17db
            - https://anchor.fm/s/115eb3dc/podcast/rss
            - http://feeds.feedburner.com/papafriki
            - https://podcastlinux.com/feed
            - https://anchor.fm/s/baa8920/podcast/rss
            - https://ugeek.github.io/podcast.xml
          filters:
            - modify_feed: feed.items = feed.items.slice(0, 100); 
            # or if you're using nightly version,
            - limit: 100
      - modify_post: |
          post.description = null;
          post.content = null;
          post.author = null;
          post.categories = [];
          post.comments = null;
          post.link = null;
          post.guid = null;
          post.source = null;
          post.extensions = {};
          post.itunes_ext = null;
          post.namespaces = {};
          post.dublin_core_ext = null;
Vctrsnts commented 5 months ago

Thanks for all work perfect and for the modification about modify_post