Skip to content

Instantly share code, notes, and snippets.

@ds729
Created April 17, 2012 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ds729/2407231 to your computer and use it in GitHub Desktop.
Save ds729/2407231 to your computer and use it in GitHub Desktop.
jQueryでRSS取得(クロスドメイン)
//http://jsdo.it/ds.style729/pkv6
//google+の場合は下記アドレスのRSSのあとにidを入れれば取れる
//http://gplus.slfeed.net/RSS2/112166094088653039891
google.load("feeds", "1");
var rssFeedUrl = "http://feedblog.ameba.jp/rss/ameblo/ske48official/rss20.xml";
$.gFeed = function(url, options, callback){
var opt = $.extend({q: url, v: '1.0', num: 10}, options);
if (!opt.q) return false;
$.getJSON('http://ajax.googleapis.com/ajax/services/feed/load?callback=?',
opt,
function(data){
if (data) callback.call(this, data.responseData.feed);
}
);
}
$(function() {
$('#feed').append('<ul/>');
$.gFeed(rssFeedUrl, {},
function(feed){
$(feed.entries).each(function() {
$('#feed ul').append("<li>"+this.title);
});
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment