2014年5月20日 星期二

透過JQuery取得flickr相簿RSS資料

參考連結:

範例:

<html>
<head>
<title></title>
</head>
<body>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://sdepold.github.io/jquery-rss/src/jquery.rss.js"></script>
<script>
jQuery(function ($) {
var rssurl = 'https://api.flickr.com/services/feeds/photos_public.gne?id=113975074@N04';
//alert(rssurl);
$("#rss-styled").rss(rssurl, {
limit: 1000,
filter: function (entry, tokens) {
$.each(tokens, function (i, item) {
if (i == "body") {
var obj = $('<div/>').append(item);
$("#rss-styled").append(obj.find('p').eq(1).html());
}
});
}
}).show();
});
</script>
<div id="rss-styled">
</div>
</body>
</html>

DEMO:

沒有留言:

張貼留言