There are 4 previous versions of this script.
// ==UserScript==
// @name GoEar Download & Hotlink
// @author Emilio Lopez (Original de Jesus "Chucky" Bayo)
// @include http://www.goear.com/listen/*/*
// @include http://goear.com/listen/*/*
// @include http://www.goear.com/listenwin.php*
// @include http://goear.com/listenwin.php*
// @version 4
// @description Descarga de Goear los temas en formato MP3. Agrega un Link y un Campo de formulario para esto.
// ==/UserScript==
/*
* This script is licensed under the
* Creative Commons Attribution-NonCommercial-ShareAlike 2.5 Argentina License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ar/
*/
//Get data to operate
if(location.href.indexOf('listenwin.php')!=-1)
var ref = location.href.split(".php?v=")[1].split("&")[0].split("#")[0];
else
var ref = location.href.split("listen/")[1].split("/")[0];
var spcode = ref.substr(0,1);
//Fake GET
GM_xmlhttpRequest({method: 'GET',
url: 'http://www.goear.com/files/xmlfiles/'+spcode+'/secm'+ref+'.xml',
onload: function(request){
//If all OK
if(request.readyState==4 && request.status==200) {
//Get Link
var responseXML = (new DOMParser).parseFromString(request.responseText, "application/xml");
var enlace = responseXML.getElementsByTagName('song')[0].getAttribute('path');
if(location.href.indexOf('listenwin.php')==-1)
{
//Inject the input
var link2 = document.createElement('div');
link2.innerHTML = '<b>Hotlink it!:</b><br><input size="50" type="text" id="songsthotlink"'+
' name="songsthotlink" class="uploadInput" onClick="javascript:document.'+
'embedCodes.songsthotlink.focus();document.embedCodes.songsthotlink.select();"'+
'readonly="true" value="'+enlace+'"><br><br>';
var form = document.getElementById('embedCodes');
form.appendChild(link2);
//Inject the link on top
var link3 = document.createElement('a');
link3.href = enlace;
link3.innerHTML = '<font face="Arial" size="2">Download this Song</font>';
var dashy = document.createTextNode(' - ');
var thediv = document.getElementsByTagName('div');
//Search the fuckin' unid'ed div
for(var i = 0;i<thediv.length;i++)
{
try{
var aelems = thediv[i].getElementsByTagName('a');
if(aelems[0].innerHTML.match('Home')!==null)
{
thediv = thediv[i];
var thelink = aelems[4].nextSibling.nextSibling;
break;
}
}catch(e){/*No anchors on the div */}
}
//Insert the link and the dash
thediv.insertBefore(link3,thelink);
thediv.insertBefore(dashy,thelink);
}else{
//Little window!
var text = document.getElementsByTagName('span')[0];
var container = document.createElement('div');
container.innerHTML = '<strong>Download:</strong> <a href="'+enlace+'">'+enlace+'</a>';
text.appendChild(container);
}
}
}
});
