限制和处理 YQL RSS feednormalizer 中的错误

发布于 2024-11-15 07:16:13 字数 515 浏览 1 评论 0原文

我使用 YQL 一次检索多个 RSS 提要(频道),使用以下查询:

SELECT * FROM feednormalizer
WHERE output="rss_2.0"
AND url in ("http://rss.cnn.com/rss/edition.rss",
            "http://bad.url.com/nothing",
            "http://rss.cnn.com/rss/edition_space.rss")

所以我实际上有 2 个问题:

  1. 如何将每个提要限制为一定数量的项目? (例如,我想从每个频道获取前 3 个项目)
  2. 请注意,第二个 URL 无效(不是真实 RSS 的 URL)。在这种情况下,YQL 结果返回 2 个有效通道以及一个错误,但没有指示哪些 URL 有效、哪些 URL 失败。
    换句话说 - 对于每个结果提要,没有指示它来自哪个 URL。
    关于如何识别每个渠道有什么想法吗?

谢谢

I'm using YQL to retrieve several RSS feeds (channels) at once, using the following query:

SELECT * FROM feednormalizer
WHERE output="rss_2.0"
AND url in ("http://rss.cnn.com/rss/edition.rss",
            "http://bad.url.com/nothing",
            "http://rss.cnn.com/rss/edition_space.rss")

so i actually have 2 questions:

  1. How can i limit each feed to a certain amount of items? (for example, I want to get top 3 items from each channel)
  2. Notice that the 2nd URL is invalid (not a URL of a real RSS). in that case, the YQL result returns 2 valid channels plus an error, but there is no indication of which URLs are valid and which one failed.
    in other words - for each result feed, there is no indication from which URL it arrived.
    any ideas as to how identify each channel?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

(り薆情海 2024-11-22 07:16:13

第一个问题:

首先想到的是使用query.multi

SELECT rss.channel.item FROM query.multi WHERE queries="
   SELECT channel.item FROM feednormalizer WHERE output='rss_2.0' AND url = 'http://rss.cnn.com/rss/edition.rss' LIMIT 3; 
   SELECT channel.item FROM feednormalizer WHERE output='rss_2.0' AND url = 'http://rss.cnn.com/rss/edition_space.rss' LIMIT 3;"

不是最优雅的方式,但它确实有效。

第二个问题:

我认为这是不可能的。由于 YQL 的 WHERE x IN ()... 语法并不是真正的 SQL 连接,因此不可能在投影中选择部分内部子查询,而这正是您的情况所需要的。

如果有人能证明我在这个问题上是错的,我会很高兴,因为我自己也需要几次,并且总是必须以编程方式解决它:)

1st question:

the first thought that comes to mind is using query.multi:

SELECT rss.channel.item FROM query.multi WHERE queries="
   SELECT channel.item FROM feednormalizer WHERE output='rss_2.0' AND url = 'http://rss.cnn.com/rss/edition.rss' LIMIT 3; 
   SELECT channel.item FROM feednormalizer WHERE output='rss_2.0' AND url = 'http://rss.cnn.com/rss/edition_space.rss' LIMIT 3;"

Not the most elegant way but it works.

2nd question:

I don't think it is possible. As YQL's WHERE x IN ()... syntax is not really an SQL join, it is not possible to select parts of the inner subquery in the projection, what you would need for your case.

Would be happy if anybody would proove me wrong on this one, as I needed that a couple of times myself and always had to work around it programatically :)

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