经过反编译,确实不是常用编码,是虾米自己的算法,找到as文件了,不太会,谁翻译一下
package xiami
{
import com.adobe.serialization.json.*;
import flash.events.*;
import
flash.net.*;
public class HQlocationDecode extends EventDispatcher
{
private var _url:String;
private var _isHQ:Boolean;
private static const getHQlocationUrl:String = "
http://www.xiami.com/song/gethqsong/sid/";
private static const getTrylocationUrl:String = "
http://www.xiami.com/song/gethqsong";
public function HQlocationDecode()
{
return;
}// end function
public function getTryLoation(param1:int, param2:String = null, param3:int = 0) : void
{
var _loc_4:* = new URLRequest(getTrylocationUrl);
var _loc_5:* = new URLVariables();
new URLVariables().sid = param1;
_loc_5.type = param2;
_loc_5.typeId = param3;
_loc_4.data = _loc_5;
var _loc_6:* = new URLLoader();
new URLLoader().addEventListener(Event.COMPLETE, this.loadCompleteHandler);
_loc_6.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
_loc_6.load(_loc_4);
return;
}// end function
public function getHQLocation(param1:int, param2:String = null, param3:int = 0) : void
{
var _loc_4:* = new URLRequest(getHQlocationUrl + param1);
var _loc_5:* = new URLLoader();
new URLLoader().addEventListener(Event.COMPLETE, this.loadCompleteHandler);
_loc_5.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
_loc_5.load(_loc_4);
return;
}// end function
private function loadCompleteHandler(event:Event) : void
{
var _loc_4:* = undefined;
var _loc_2:* = event.target.data;
var _loc_3:* = JSON.decode(_loc_2).status;
if (_loc_3 == 1)
{
this._isHQ = true;
_loc_4 = JSON.decode(_loc_2).location;
this._url = this.getLocation(_loc_4);
}
else
{
this._isHQ = false;
this._url = null;
}
dispatchEvent(new Event(Event.COMPLETE));
return;
}// end function
private function errorHandler(event:Event) : void
{
this._isHQ = false;
dispatchEvent(new IOErrorEvent(IOErrorEvent.IO_ERROR));
return;
}// end function
public function get url() : String
{
return this._url;
}// end function
public function get isHQ() : Boolean
{
return this._isHQ;
}// end function
public function getLocation(param1:String) : String
{
var _loc_10:* = undefined;
var _loc_2:* = Number(param1.charAt(0));
var _loc_3:* = param1.substring(1);
var _loc_4:* = Math.floor(_loc_3.length / _loc_2);
var _loc_5:* = _loc_3.length % _loc_2;
var _loc_6:* = new Array();
var _loc_7:* = 0;
while (_loc_7 < _loc_5)
{
if (_loc_6[_loc_7] == undefined)
{
_loc_6[_loc_7] = "";
}
_loc_6[_loc_7] = _loc_3.substr((_loc_4 + 1) * _loc_7, (_loc_4 + 1));
_loc_7 = _loc_7 + 1;
}
_loc_7 = _loc_5;
while (_loc_7 < _loc_2)
{
_loc_6[_loc_7] = _loc_3.substr(_loc_4 * (_loc_7 - _loc_5) + (_loc_4 + 1) * _loc_5, _loc_4);
_loc_7 = _loc_7 + 1;
}
var _loc_8:* = "";
_loc_7 = 0;
while (_loc_7 < _loc_6[0].length)
{
_loc_10 = 0;
while (_loc_10 < _loc_6.length)
{
_loc_8 = _loc_8 + _loc_6[_loc_10].charAt(_loc_7);
_loc_10 = _loc_10 + 1;
}
_loc_7 = _loc_7 + 1;
}
_loc_8 = unescape(_loc_8);
var _loc_9:* = "";
_loc_7 = 0;
while (_loc_7 < _loc_8.length)
{
if (_loc_8.charAt(_loc_7) == "^")
{
_loc_9 = _loc_9 + "0";
}
else
{
_loc_9 = _loc_9 + _loc_8.charAt(_loc_7);
}
_loc_7 = _loc_7 + 1;
}
_loc_9 = _loc_9.replace("+", " ");
return _loc_9;
}// end function
}
}