问题
I have a pipe that filters an RSS feed and removes any item that contains "stopwords" that I've chosen. Currently I've manually created a filter for each stopword in the pipe editor, but the more logical way is to read these from a file. I've figured out how to read the stopwords out of the text file, but how do I apply the filter operator to the feed, once for every stopword?
The documentation states explicitly that operators can't be applied within the loop construct, but hopefully I'm missing something here.
回答1:
You're not missing anything - the filter operator can't go in a loop.
Your best bet might be to generate a regex out of the stopwords and filter using that. e.g. generate a string like (word1|word2|word3|...|wordN)
.
You may have to escape any odd characters. Also I'm not sure how long a regex can be so you might have to chunk it over multiple filter rules.
回答2:
In addition to Gavin Brock's answer the following Yahoo Pipes filters the feed items (title, description, link and author) according to multiple stopwords:
- Pipes Info
- Pipes Edit
- Pipes Demo
Inputs
- _render=rss
- feed=http://example.com/feed.rss
- stopwords=word1-word2-word3
来源:https://stackoverflow.com/questions/2693673/yahoo-pipes-filter-items-in-a-feed-based-on-words-in-a-text-file