Replace SWR error message at http://mp3-live.swr.de/ with player links.
// ==UserScript== | |
// @name SWR Radio M3U | |
// @namespace de.schmucker-partner.swr.m3u | |
// @include http://mp3-live.swr.de/ | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
var urls = [ | |
'http://mp3-live.swr.de/swr1bw_m.m3u', | |
'http://mp3-live.swr.de/swr1rp_m.m3u', | |
'http://mp3-live.swr.de/swr2_m.m3u', | |
'http://mp3-live.swr.de/swr4bw_m.m3u', | |
'http://mp3-live.swr.de/swr4rp_m.m3u', | |
'http://mp3-live.swr.de/swrinfo_m.m3u' | |
]; | |
document.body.innerHTML=""; | |
document.title="SWR"; | |
for(var i=0;i<urls.length;i++){ | |
var x = new XMLHttpRequest(); | |
x.open("GET",urls[i],true); | |
x.overrideMimeType("text/plain"); | |
x.onload = function(req){ | |
var url = /(?:^|\n\r?)(http\:\/\/.*?)(?:\n|$)/.exec(req.responseText); | |
if(url){ | |
var title = /(?:^|\n\r?)#EXTINF\:\-1,(.*?)(?:\n|$)/.exec(req.responseText); | |
if(title){ | |
var h=document.createElement("h3"); | |
h.textContent = title[1]; | |
document.body.appendChild(h); | |
} | |
var media = document.createElement('video'); | |
media.autoplay = false; | |
media.src = url[1]; | |
media.controls = true; | |
media.style.height="32px"; | |
media.style.width="96px" | |
document.body.appendChild(media); | |
} | |
}.bind(null,x); | |
x.send(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment