I cant seem to find info anywhere on how to strip html tags from the summary/title/etc fields of rss feeds using Feedzirra.
我似乎无法在任何地方找到关于如何从rss提要的摘要/标题/etc字段中删除html标记的信息。
Here is my code:
这是我的代码:
# Get feed details
feed = Feedzirra::Feed.fetch_and_parse(rssUrl)
feed.entries.each do |entry|
logger.debug("ENTRY.SummaryWithHtmlTags = #{entry.summary}")
end
Any ideas how to strip the html tags from fields?
有什么想法可以从字段中去掉html标签吗?
1 个解决方案
#1
1
I'm learning so maybe I'm missing something but can't you do this?
我在学习,所以可能我漏掉了什么但你不能这样做吗?
include ActionView::Helpers::SanitizeHelper
# Get feed details
feed = Feedzirra::Feed.fetch_and_parse(rssUrl)
feed.entries.each do |entry|
stripped_summary = strip_tags(entry.summary)
logger.debug("ENTRY.SummaryWithHtmlTags = #{stripped_summary}")
end
#1
1
I'm learning so maybe I'm missing something but can't you do this?
我在学习,所以可能我漏掉了什么但你不能这样做吗?
include ActionView::Helpers::SanitizeHelper
# Get feed details
feed = Feedzirra::Feed.fetch_and_parse(rssUrl)
feed.entries.each do |entry|
stripped_summary = strip_tags(entry.summary)
logger.debug("ENTRY.SummaryWithHtmlTags = #{stripped_summary}")
end