Parsing 解析rss提要。某些字段未定义
我正在尝试解析此rss源- 我使用以下代码对其进行解析:Parsing 解析rss提要。某些字段未定义,parsing,rss,undefined,Parsing,Rss,Undefined,我正在尝试解析此rss源- 我使用以下代码对其进行解析: $.ajax({ url : document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent('http://www.spiegel.de/international/germany/in
$.ajax({
url : document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' +
encodeURIComponent('http://www.spiegel.de/international/germany/index.rss'),
dataType : 'json',
success : function (data) {
if (data.responseData.feed && data.responseData.feed.entries) {
$.each(data.responseData.feed.entries, function (i, e) {
console.log("------------------------");
console.log("title : " + e.title);
console.log("link : " + e.link);
console.log("pubDate : " + e.pubDate);
console.log("description : " + e.description);
console.log("pubDate : " + e.pubDate);
console.log("guid: " + e.guid);
});
}
}
});
在console.log中,仅显示标题和链接。描述、发布日期和guid都未定义
有人能解释一下我做错了什么吗?你可以用这个来检查谷歌给出的整个“模式”
您将看到每个条目都有以下项:
- 头衔
- 链接
- 作者
- 出版日期
- 内容片段
- 内容
- 类别
guid
。您必须使用content
(或contentSnippet
)而不是description,并使用publishedDate
而不是pubDate
。如果您真的需要guid
请查看(我创建了Superfeedr!)