Google AJAX Feed API テスト
AmazonのベストセラーをBloggerで表示する
<script src="http://www.google.com/jsapi" type="text/javascript">
</script>
<script type="text/javascript">
google.load("feeds", "1");
function initialize() {
var feedurl = "http://www.amazon.co.jp/rss/bestsellers/books/ref=pd_ts_rss_link?tag=hogehoge-33";
var feed = new google.feeds.Feed(feedurl);
feed.setNumEntries(8);
feed.load(dispfeed);
function dispfeed(result){
if (!result.error){
var container = document.getElementById("feed");
var htmlstr = "";
htmlstr += "<p>[タイトル]" + result.feed.title + "</p>";
htmlstr += "<ul>";
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
htmlstr += "<li>"
htmlstr += '<a href="' + entry.link + '">' + entry.title + '</a> ';
htmlstr += '<img src="http://b.hatena.ne.jp/entry/image/large/' + entry.link + '" />';
htmlstr += entry.content;
htmlstr += "</li>"
}
htmlstr += "</ul>";
container.innerHTML = htmlstr;
}else{
alert(result.error.code + ":" + result.error.message);
}
}
}
google.setOnLoadCallback(initialize);
</script>
<br />
Google AJAX Feed API テスト<br />
<div id="feed">
</div>
Tags:
作った