【问题标题】:jQuery RSS parsing issue with Delicious feed带有 Delicious 提要的 jQuery RSS 解析问题
【发布时间】:2011-01-20 17:26:39
【问题描述】:

我正在尝试解析我的美味链接提要以生成自定义 html。我无法解析 item.link 和 item.creator(以下 rss 的索引 3,4)。

美味/我的用户名 http://www.delicious.com/myusername 我的用户名发布的书签

<item>
  <title>Full-function Core Data example app « Peter McIntyre</title>
  <pubDate>Mon, 11 Nov 2005 04:02:00 -0730</pubDate>
  <guid isPermaLink="false">http://www.delicious.com/url/8b20ab1d1fa021f744acb67f69e22a36#myusername</guid>
  <link>http://petermcintyre.wordpress.com/2010/02/24/full-function-core-data-example-app/</link>
  <dc:creator><![CDATA[myusername]]></dc:creator>
  <comments>http://www.delicious.com/url/8b20ab1d1fa021f744acb67f69e22a36</comments>
  <wfw:commentRss>http://feeds.delicious.com/v2/rss/url/8b20ab1d1fa021f744acb67f69e22a36</wfw:commentRss>
  <source url="http://feeds.delicious.com/v2/rss/myusername">myusername's bookmarks</source>
  <category domain="http://www.delicious.com/myusername/">iphone,</category>
  <category domain="http://www.delicious.com/myusername/">coredata,</category>
</item>
<item>
  <title>Is there a high-level gestures library for iPhone development? - Stack Overflow</title>
  <pubDate>Fri, 24 Sep 2008 09:19:16 +0730</pubDate>
  <guid isPermaLink="false">http://www.delicious.com/url/5082a6b90d2dfecbf9673c3f61e45abc#myusername</guid>
  <link>http://stackoverflow.com/questions/907512/is-there-a-high-level-gestures-library-for-iphone-development</link>
  <dc:creator><![CDATA[myusername]]></dc:creator>
  <comments>http://www.delicious.com/url/5082a6b90d2dfecbf9673c3f61e45abc</comments>
  <wfw:commentRss>http://feeds.delicious.com/v2/rss/url/5082a6b90d2dfecbf9673c3f61e45abc</wfw:commentRss>
  <source url="http://feeds.delicious.com/v2/rss/myusername">myusername's bookmarks</source>
  <category domain="http://www.delicious.com/myusername/">iPhone</category>
  <category domain="http://www.delicious.com/myusername/">gesture</category>
  <category domain="http://www.delicious.com/myusername/">objc</category>
  <category domain="http://www.delicious.com/myusername/">gesture-recognization</category>
</item>

这是我的 jQuery 代码,我从 id 为“rss”的 textarea 获取 rss 输入,并尝试在 firebug 控制台中打印链接。

feed = $('#rss').val();

$(feed).find('item').each(function(){ console.log($(this).children().eq(3).text());

});

由于某种原因,完整的 xml 没有正确呈现,这里是美味饲料的 pastebin 链接http://pastebin.com/KbDNyL0P

更新: 似乎我使用了一些错误的 jQuery 版本/发行版,我从导致问题的插件目录中复制了 jQuery。经验教训:总是从 jQuery/GoogleCode 网站下载。

【问题讨论】:

    标签: jquery parsing rss delicious-api


    【解决方案1】:

    尝试使用 json

    http://feeds.delicious.com/v2/json/myusername?count=15

    $.ajax({
       dataType: 'jsonp',
       data: 'count=15',
       jsonp: 'callback',
       url: 'http://feeds.delicious.com/v2/json/myusername?callback=?',
       success: function (data) {
          $.each(data, function(i,item){
             console.log(item.u);
          });
       }
    });
    

    【讨论】:

    • thnx 将尝试更新。 Delicious 最多只提供 100 个带有 JSON 的书签,因为 RSS 可以一次获取所有链接。我在这里寻找 rss 解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 2011-01-27
    • 1970-01-01
    • 1970-01-01
    • 2012-10-02
    • 2014-08-26
    • 1970-01-01
    相关资源
    最近更新 更多