Skip to content

Instantly share code, notes, and snippets.

@mgng
Created July 29, 2009 10:02
Show Gist options
  • Save mgng/157965 to your computer and use it in GitHub Desktop.
Save mgng/157965 to your computer and use it in GitHub Desktop.
8tracksで再生されてるmp3のリンクを表示するやつ
(function(b,i,l){
function x(u,f){
var o=new XMLHttpRequest()||new ActiveXObject('Microsoft.XMLHTTP');
o.onload=f;o.open('GET',u,true);o.send(null);
}
b=document.getElementsByTagName('div');
for(i=0,l=b.length;i<l;++i){
if (/track_details_[0-9]/.test(b[i].id)) {
var u='http://8tracks.com/sets/1234567980/play.xml?track_id='+b[i].id.replace('track_details_','');
x(u,function(){
var t= this.responseText,
x=t.match(/<item>(.+)<\/item>/),
y=t.match(/<contributor>(.+)<\/contributor>/),
z=t.match(/<title>(.+)<\/title>/);
if (x[1]) {
var d=[x[1],y[1]||x[1],z[1]||''],h=document.createElement('h1');
h.innerHTML='<a href="'+d[0]+'">'+d[2]+'@'+d[1]+'</a>'
document.body.appendChild(h);
}
});
}
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment