0

我正在使用名为 feedjira 的 gem 来解析 rails 中的 rss 提要。

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

例如,它返回以下汇总字段值

"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\"/>"

如何删除/跳过内容中的宣传图片?

提前致谢。

4

1 回答 1

-1
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;
}
于 2015-11-20T14:37:10.813 回答