How to extract titles, images and text from any kind of feed?
I want to extract the titles, images and text from any kind of Feed Rss ( feedburner, xml, etc ).
How can I do this with javascript ?
For example, I want to extract the stuff above from this feed:
http://feeds.mashable.com/Mashable
and from this feed:
http://casadi开发者_Python百科pacheco.blogspot.com/feeds/posts/default
Google feeds api: http://code.google.com/apis/ajaxfeeds/
google.load("feeds", "1");
function initialize() {
var feed = new google.feeds.Feed("http://feeds.mashable.com/Mashable?format=xml");
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 div = document.createElement("div");
div.appendChild(document.createTextNode(entry.title));
container.appendChild(div);
}
}
});
}
google.setOnLoadCallback(initialize);
精彩评论