转换迅雷,旋风,快车地址JS代码

迅雷下载,旋风下载,快车下载软件都有自己各自的格式地址。新一使用的下载软件是旋风,但是网上经常找到的资源提供的是迅雷下载链接,让新一很头疼,幸好网上有大牛分析了他们各自的链接给出互相转换的地址。以下代码是新一在某一个提供迅雷地址转换的网页中提取出来的Javascript代码。

function urlconvert(){
  var oldurl=$("#oldurl").attr("value");
  oldurl=trimString(oldurl);
  if (oldurl==''){
	  alert('请输入URL地址!');
	  return false;
  }else if(/thunder:\/\//i.test(oldurl)){
      newurl=Thunderdecode(oldurl);
  }else if(/flashget:\/\//i.test(oldurl)){
      newurl=Flashgetdecode(oldurl);
  }else if(/qqdl:\/\//i.test(oldurl)){
      newurl=qqdecode(oldurl);
  }else if(/fs2you:\/\//i.test(oldurl)){
      newurl=FS2Decode(oldurl);
  }else{
	   newurl=oldurl;
	   //alert('这个地址貌似不是迅雷,快车,旋风,FS2任何一种的下载地址!');
	   //return false;
  }
  thunderurl=ThunderEncode(newurl);
  flashgeturl=flashetencode(newurl);
  qqurl=qqencode(newurl);
  $("#oldurl").attr("value",oldurl);
  $("#newurl").attr("value",newurl);
  $("#thunderurl").attr("value",thunderurl);
  $("#flashgeturl").attr("value",flashgeturl);
  $("#qqurl").attr("value",qqurl);
}

function ConvertURL2FG(url,fUrl,uid)
	{	
		try{
			FlashgetDown(url,uid);
		}catch(e){location.href = fUrl;}
}
function Flashget_SetHref(obj,uid){obj.href = obj.fg;}
 function   trimString(str)   
  {   
  var   re;   
  var   newstr;   
  re   =   new   RegExp("^(\\s)*");   
  re2   =   new   RegExp("(\\s)*$");   
  newstr   =   str.replace(re,"");   
  newstr   =   newstr.replace(re2,"");   
    
  return   newstr;   
}   
function qqencode(url){
   url='qqdl://'+encode64(url);
   return url;
}
function flashetencode(url){
   url='Flashget://'+encode64('[FLASHGET]'+url+'[FLASHGET]')+'&1926';
   return url;
}
 function ThunderEncode(t_url) {
	var thunderPrefix = "AA";
	var thunderPosix = "ZZ";
	var thunderTitle = "thunder://";
	var tem_t_url = t_url;
	var thunderUrl = thunderTitle + encode64(thunderPrefix + tem_t_url + thunderPosix);
	return thunderUrl;
}

function Thunderdecode(url) {
	 url=url.replace('thunder://','');
     thunderUrl=decode64(url);
	 thunderUrl=thunderUrl.substr(2,thunderUrl.length-4);
	 return thunderUrl;
}

function Flashgetdecode(url){
    url=url.replace('Flashget://','');
	if (url.indexOf('&')!=-1)
	{
		url=url.substr(0,url.indexOf('&'));	 
	}
	url=decode64(url);
	flashgeturl=url.replace('[FLASHGET]','');
	flashgeturl=flashgeturl.replace('[FLASHGET]','');
	 
	return flashgeturl;
}
function  qqdecode(url){
	url=url.replace('qqdl://','');
    qqurl=decode64(url);
    return qqurl;
}


//FS2地址
function  FS2Decode(url){
    url=url.replace('fs2you://','');
    fs2url=decode64(url).split("|")[0];
    fs2url="http://"+fs2url;
    return fs2url;
}



转载请注明来源:新一 » 转换迅雷,旋风,快车地址JS代码

赞 (0) 评论 (0) 分享 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址