IFTTT能否基于现有RSS生成多份筛选RSS?替代方案有哪些?
Got it—you want to take an RSS feed you don't control (like your "Fruits" feed) and split it into targeted sub-feeds (Apples, Oranges) that auto-sync new entries matching specific title substrings. Here are a few practical, actionable ways to pull this off:
Method 1: Self-Hosted Python Script (Full Control)
If you want complete control over the filtering logic and can run a small script on a server, Raspberry Pi, or even a desktop with auto-start, this is a solid option. The script will periodically fetch the original feed, filter entries, and generate the new feeds.
First, install the required packages:
pip install feedparser rssgenerator flask
Here's a simplified example that serves the filtered feeds via a web server (so users can subscribe to URLs like http://your-server:5000/apples):
import feedparser from rssgenerator import RSSGenerator, Item from flask import Flask, Response import time app = Flask(__name__) # Configuration ORIGINAL_FEED_URL = "https://example.com/fruits.rss" CACHE_DURATION = 900 # 15 minutes in seconds cached_feed = None cache_time = 0 def get_original_feed(): global cached_feed, cache_time now = time.time() if not cached_feed or now - cache_time > CACHE_DURATION: cached_feed = feedparser.parse(ORIGINAL_FEED_URL) cache_time = now return cached_feed def generate_filtered_feed(filter_term): original = get_original_feed() generator = RSSGenerator( title=f"Fruits - {filter_term.capitalize()}", link=original.feed.link, description=f"Entries from Fruits feed containing '{filter_term}' in the title" ) # Case-insensitive filter on title for entry in original.entries: if filter_term.lower() in entry.title.lower(): item = Item( title=entry.title, link=entry.link, description=entry.get('description', ''), pubdate=entry.get('published', '') ) generator.items.append(item) return generator.generate() @app.route('/apples') def apples_feed(): rss_content = generate_filtered_feed('apple') return Response(rss_content, mimetype='application/rss+xml') @app.route('/oranges') def oranges_feed(): rss_content = generate_filtered_feed('orange') return Response(rss_content, mimetype='application/rss+xml') if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
You can set this up to run automatically on boot (using systemd on Linux, for example) and adjust the cache duration or filter logic as needed.
Method 2: Use an RSS Aggregator with Filtering
If coding isn't your thing, many self-hosted or managed RSS aggregators let you create custom filtered feeds without writing any code. Here's how it usually works:
- Add your original "Fruits" feed to the aggregator
- Create two new "smart feeds" (the name varies by tool)
- For each smart feed, add a filter rule:
- For Apples: Match entries where the title contains
apple(enable case-insensitive matching if needed) - For Oranges: Match entries where the title contains
orange
- For Apples: Match entries where the title contains
- The aggregator will automatically update these smart feeds whenever the original feed has new content, and you can grab the feed URL for each to share with your users.
Method 3: Serverless Function (No Persistent Hosting)
If you don't want to run a server 24/7, you can use a serverless function (from any major cloud provider) that generates the filtered feed on demand when someone subscribes to the URL. The logic is similar to the Python script above, but it runs only when a request is made:
- The function receives a request for
/applesor/oranges - It fetches the original feed (with caching to avoid hitting it too often)
- Filters entries based on the corresponding term
- Returns the generated RSS feed as the response
This way, you don't have to maintain a running server—you just deploy the function and share the URLs.
Pro Tips
- Case Sensitivity: Most tools let you toggle case-insensitive matching, which is usually what you want (so "Apple Pie" and "apple sauce" both show up in the Apples feed).
- Caching: Always add caching for the original feed to avoid rate-limiting or getting blocked by the feed provider.
- Error Handling: Add logic to handle cases where the original feed is unavailable—return a cached version or a friendly error in the RSS feed so subscribers don't see broken content.
内容的提问来源于stack exchange,提问作者JBart

