2008/01/31


PLAYLOGMashUp Awardが開催されています。
適当にYahoo Pipes!でパイプってJSONで取得するものを作ってみました。
URL:PLAYLOG Playlist(JSON)
ただ、Yahoo Pipes!側が悪いのか、日本語を含むアーティストが文字化けを起こしています。だれか解決方法知ってたら教えて下さい。
使用は適当にどうぞ... <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script type="text/javascript"><!--
if (window.addEventListener) window.addEventListener("load", loadScript, false);
if (window.attachEvent) window.attachEvent("onload", loadScript);
function loadScript(){
  var script = document.createElement("script");
  script.charset = "utf-8";
  script.src = "http://pipes.yahoo.com/pipes/pipe.run?...";
  document.body.appendChild(script);
  document.getElementById('result').innerHTML = "<em>reading...</em>";
}
function callback(data){
  var html = "";
  for(n = 0; n < data.count; n++) {
    link = data.value.items[n]['playlog:artistlink'];
    artist = data.value.items[n]['playlog:artist'];
    title = data.value.items[n]['title'];
    html += "<a href=\"" + (link ? link : "javascript:void(0)") + "\">";
    html += (artist ? artist : "unknown") + " - " + (title ? title : "unknown");
    html += "</a><br />";
  }
  document.getElementById('result').innerHTML = html;
}
// --></script>
<title>Sample</title>
</head>
<body>
<h1>PLAYLOG</h1>
<div id="result"></div>
</body>
</html>
Posted at by | Edit