使用 YQL 获取 RSS 提要的标题
我正在使用 YQL 使用 javascript(作为 json)检索 RSS 提要,例如我使用以下查询:
select * from rss where url = "http://feeds2.feedburner.com/ajaxian"
响应包含提要项,已解析为 json,到目前为止一切都很酷。
现在,我还想获取整个提要的标题(而不是特定项目的标题),但它不是结果的一部分(即使原始 XML 提要包含它)。
可以查询原始 XML 本身。例如:
select channel.title from xml where url = "http://feeds2.feedburner.com/ajaxian"
它确实返回该特定 RSS 的提要标题,但该查询仅对 RSS 2.0 格式的提要有效,该提要将其存储在 rss\channel\title 下。
将标题存储在 feed\title 下的 Atom feeds 怎么样?
其他格式呢?
我的问题是 - 有没有通用的方法可以通过 YQL 请求提要的标题?也许与饲料本身一起?
谢谢,
I'm using YQL to retrieve an RSS feed using javascript (as json), for example i use the following query:
select * from rss where url = "http://feeds2.feedburner.com/ajaxian"
The response contains the feed items, already parsed as json and everything is cool so far.
Now, I also want to get the title of the entire feed (not the title of a specific item) - but it's not a part of the result (even though the original XML feed contains it).
There is the possibility of querying the original XML itself. for example:
select channel.title from xml where url = "http://feeds2.feedburner.com/ajaxian"
and it indeed returns the feed title for that specific RSS, but that query is only valid for a RSS 2.0 formatted feeds, which stores it under rss\channel\title.
What about atom feeds which store the title under feed\title ?
What about other formats?
My question is - is there any generic way to request the feed's title through YQL? maybe somehow along with the feed itself?
thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 feednormalizer 表将 feed(无论其格式如何)转换为一种标准格式,然后从该格式的正确节点获取标题。
要获取 Ajaxian 提要,将其“规范化”为 Atom 并获取提要标题,查询将如下所示:
(在 YQL 控制台中尝试此操作)
You can use the
feednormalizer
table to convert the feed (regardless of its format) into one of the standard formats, then grab the title from the proper node for that format.To take the Ajaxian feed, "normalize" it as Atom and get the feed title, the query would look like:
(Try this in the YQL console)
您还可以使用其他表格,例如
feed
、rss
和atom
。关于如何查找数据表的后续问题:
转到 YQL 控制台,确保社区表已加载(此链接应该已经是这种情况),然后只需在右侧的搜索框中输入您要查找的内容寻找 为了。通常你可以找到一些有用的东西。
There are also other tables that you can use like
feed
,rss
andatom
.Regarding your follow up question of how to find data tables:
Go to the YQL console, make sure that the Community Tables are loaded (should already be the case with this link) and then just type in the search box on the right hand side what you are looking for. Often you can find something useful.