如何使用YQL合并按pubDate排序的2个RSS feed? [英] How to use YQL to merge 2 RSS feeds sorted by pubDate?
本文介绍了如何使用YQL合并按pubDate排序的2个RSS feed?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
看到将YQL作为一种做事的好方法而得到了提升,我很好奇如何使用YQL将2个不同的供稿合并到一个供稿中(按pubDate排序).
Seeing that YQL is being promoted as a good way to do things, I was curious as to how to use YQL to fetch and merge 2 different feeds into one (sorted by pubDate).
获取2个提要很简单,但事实证明提要只是串联在一起而不是合并.
It's pretty trivial to fetch 2 feeds but it turns out that the feeds are just concatenated together and not merged.
这是示例代码.
select channel.title,channel.link,channel.item.title,channel.item.link
from xml where url in(
'http://code.flickr.com/blog/feed/rss/',
'http://feeds.delicious.com/v2/rss/codepo8?count=15',
'http://www.stevesouders.com/blog/feed/rss',
'http://www.yqlblog.net/blog/feed/',
'http://www.quirksmode.org/blog/index.xml'
)
推荐答案
感谢您提供此信息.当访问rss对象时,它也可以工作:
Thanks for this info. It works when accessing the rss object, too:
select title,link,pubDate from rss where url in (
'http://feeds.delicious.com/v2/rss/hasematzel?count=3',
'http://oliverschwarz.tumblr.com/rss',
'http://twitter.com/statuses/user_timeline/818226.rss',
'http://hasematzel.de/blog/feed/',
'http://piepmatzel.de/feed/'
) | sort(field="pubDate", descending="true")
这是创建新闻编辑室或生命周期的非常简单的方法.不要忘了强制缓存YQL返回:)
This is a very simple way to create a newsroom or a lifestream. Don't forget to force-cache the YQL return :)
这篇关于如何使用YQL合并按pubDate排序的2个RSS feed?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文