How to skip parsing the promoted image content in RSS feed using Feedzirra / Feedjira

141 views Asked by At

I am using the gem called feedjira to parse rss feeds in rails.

Feedjira::Feed.add_feed_class Feedjira::Parser::RSS
feed = Feedjira::Feed.fetch_and_parse site[:url]
news = feed.entries

For example, It returns the following summary field value

"WASHINGTON, Aug 10 - Guggenheim Partners Investment Management LLC has agreed 
to pay $20 million to settle federal charges that it failed to disclose a
$50 million loan by a client to a senior executive, the Securities and  
Exchanges Commission said on Monday.<br clear='all'/><br/><br/>
<a href=\"http://rc.feedsportal.com/r/234566992987/u/0/f/415367.htm\" 
rel=\"nofollow\">
<img src=\"http://rc.feedsportal.com/r/234566992987/u/0/f/rc.img\"
border=\"0\"/></a><br/><br/>
<a href=\"http://rc.feedsportal.com/r/234566992987/u/0/rc.htm\"
rel=\"nofollow\">
<img src=\"http://rc.feedsportal.com/r/234566992987/u/rc.img\"
border=\"0\"/></a><br/><br/><a href=\"http://da.feedsportal.com
/r/234566992987/u/0/f/a2.htm\">
<img src=\"http://da.feedsportal.com/r/234566992987/a2.img\" 
border=\"0\"/></a><img width=\"1\" height=\"1\"
src=\"http://pi.feedsportal.com/r/234566992987/u/0/f/a2t.img\"
 border=\"0\"/>"

How want to remove/skip the promoted images in the content ?

Thanks in advance.

1

There are 1 answers

1
Chetram On
function rss_refine_string($get_rtext){
    $get_rtext = str_replace("&quot;", "", $get_rtext);
    $get_rtext = str_replace("&lt;", "<", $get_rtext);
    $get_rtext = str_replace("&gt;", ">", $get_rtext);
    return $get_rtext;
}