我的问题如下:我写了一个 rss.xml
<media:group>
<media:thumbnail url:"johndoe.at/images/test.jpg" width='auto' height='50'>
....
....
一张图片。
可以从 rss 中提取所有内容,但无法提取媒体内容。我怎样才能做到这一点?我使用以下 JS 代码提取的所有其他字段:
function initialize() {
var feed = new google.feeds.Feed("http://fastpshb.appspot.com/feed/1/fastpshb");
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("feed");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var title = entry.title;
var content = entry.content;
}
}
});
}
最佳答案
我相信这将作为 mediaGroups 属性数组提供,因此您会拥有
// verify mediaGroups are present and then retrieve the first one's URL.
if (entry.mediaGroups) {
var thumbnail = entry.mediaGroups[0].contents[0].url;
}
关于javascript - rss 提要谷歌媒体 :group,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14480662/