ruby-on-railsfeedzirra

Stripping Html tags from Rss feeds using Feedzilla


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.SummaryWithHtmlTags = #{entry.summary}")

  end

Any ideas how to strip the html tags from fields?


Solution

  • 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