使用 YQL 获取 RSS 提要的标题

发布于 2024-11-09 05:26:32 字数 603 浏览 3 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

葬シ愛 2024-11-16 05:26:32

您可以使用 feednormalizer 表将 feed(无论其格式如何)转换为一种标准格式,然后从该格式的正确节点获取标题。

要获取 Ajaxian 提要,将其“规范化”为 Atom 并获取提要标题,查询将如下所示:

SELECT title
FROM   feednormalizer
WHERE  output="atom_1.0" AND url="http://feeds2.feedburner.com/ajaxian"

(在 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:

SELECT title
FROM   feednormalizer
WHERE  output="atom_1.0" AND url="http://feeds2.feedburner.com/ajaxian"

(Try this in the YQL console)

瑶笙 2024-11-16 05:26:32

您还可以使用其他表格,例如 feedrssatom

关于如何查找数据表的后续问题:

转到 YQL 控制台,确保社区表已加载(此链接应该已经是这种情况),然后只需在右侧的搜索框中输入您要查找的内容寻找 为了。通常你可以找到一些有用的东西。

There are also other tables that you can use like feed, rss and atom.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文