我使用yahoo管道创建了一个RSS提要,但我希望在描述中使用title,在标题中使用description。我想换一下标题和描述。
<item>
<title>"**title**"</title>
<description>"**description**"</description>
<link>http://link</link>
</item>
我想要
<item>
<title>"**description**"</title>
<description>"**title**"</description>
<link>http://link</link>
</item>
这里有一种方法可以做到这一点-使用3个Pipes模块来交换标题和描述字段:
- 获取提要:拉入RSS提要。我使用的是雅虎财经的一个例子
- 重命名:将item.title复制为newDesc,将item.description复制为newTitle
- 创建RSS:将title设置为newTitle,将description设置为newDesc,其他设置为默认值
我创建了一个示例管道,您可以从中查看和复制:http://pipes.yahoo.com/pipes/pipe.info?_id=ffc846056c71a4dd3df7b01d16fdd613
以下是雅虎财经RSS源的一个示例:
<item>
<title>Samsung Posts $7.4B Profit as Handsets Mask Weak Chip Sales</title>
<link>http://us.rd.yahoo.com/finance/news/rss/story/SIG=149kpevtc/*http%3A//us.rd.yahoo.com/finance/news/topfinstories/SIG=126hhlj6u/*http%3A//finance.yahoo.com/news/samsung-posts-7-4-bln-234859667.html?l=1</link>
<description>Samsung Electronics Co., the world's top technology firm by revenue, reported record quarterly profit of $7.4 billion on Friday, with strong sales of its Galaxy range of phones masking sharply lower memory chip sales.</description>
<guid isPermaLink="false">yahoo_finance/1866191516</guid>
<pubDate>Fri, 26 Oct 12 00:55:44 GMT</pubDate>
</item>
这是来自采样管道的相应输出,标题为&描述交换:
<item>
<title>Samsung Electronics Co., the world's top technology firm by revenue, reported record quarterly profit of $7.4 billion on Friday, with strong sales of its Galaxy range of phones masking sharply lower memory chip sales.</title>
<link>http://us.rd.yahoo.com/finance/news/rss/story/SIG=149kpevtc/*http%3A//us.rd.yahoo.com/finance/news/topfinstories/SIG=126hhlj6u/*http%3A//finance.yahoo.com/news/samsung-posts-7-4-bln-234859667.html?l=1</link>
<description>Samsung Posts $7.4B Profit as Handsets Mask Weak Chip Sales</description>
<guid isPermaLink="false">yahoo_finance/1866191516</guid>
<pubDate>Sat, 30 Mar 1918 19:36:14 +0000</pubDate>
</item>
注意:在我上面的示例中,pubDate发生了一些事情。我认为这可能是雅虎管道缓存问题,下次管道运行时会解决。