开发者

Stripping Html tags from Rss feeds using Feedzilla

开发者 https://www.devze.com 2023-03-02 18:04 出处:网络
I cant seem to find info anywhere on how to strip html tags from the summary/title/etc fields of rss feeds using Feedzirra.

I cant seem to find info anywhere on how to strip html tags from the summary/title/etc fields of rss feeds using Feedzirra.

Here is my code:

# Get feed details
feed = Feedzirra::Feed.fetch_and_parse(rssUrl)

  feed.entries.each do |entry|

    logger.debug("ENTRY.SummaryWithHtmlTa开发者_如何学JAVAgs = #{entry.summary}")

  end

Any ideas how to strip the html tags from fields?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号