酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319
以下内容为反编译后的 k.java 源代码,内容仅作参考
package com.kugou.babu.d;
import android.content.Context;
import android.os.Looper;
import android.text.TextUtils;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.kugou.babu.entity.SearchLyricEntity;
import com.kugou.babu.entity.SearchLyricSubEntity;
import com.kugou.common.apm.ApmDataEnum;
import com.kugou.common.apm.b;
import com.kugou.common.config.ConfigKey;
import com.kugou.common.utils.as;
import com.kugou.common.utils.br;
import com.kugou.common.utils.cj;
import com.kugou.ktv.android.protocol.c.d;
import com.kugou.ktv.android.protocol.c.i;
import com.kugou.ktv.framework.common.a.a;
import com.sina.weibo.sdk.auth.Oauth2AccessToken;
import com.tencent.stat.DeviceInfo;
import java.util.ArrayList;
import java.util.Hashtable;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONTokener;
public class k extends d {
public interface a {
void a(int i, String str, i iVar);
void a(SearchLyricEntity searchLyricEntity);
}
public k(Context context) {
super(context);
}
public void a(String str, String str2, long j, String str3, final a aVar) {
if (TextUtils.isEmpty(str2)) {
a(aVar, -1, "搜索关键字有误", i.client);
return;
}
if (!cj.d(this.f62378d)) {
a(aVar, -2, "网络状况不佳,请联网重试", i.client);
return;
}
if (!com.kugou.common.environment.a.o() && Looper.getMainLooper() == Looper.myLooper()) {
br.T(this.f62378d);
a(aVar, -3, "", i.client);
return;
}
ConfigKey configKey = new ConfigKey("ktv.lyric.url.search");
if (TextUtils.isEmpty("http://lyrics.kugou.com/search")) {
a(aVar, -4, "请求地址有误", i.client);
return;
}
if (!TextUtils.isEmpty(str3)) {
str3 = str3.toLowerCase();
}
Hashtable<String, Object> hashtable = new Hashtable<>();
hashtable.put("client", "mobi");
hashtable.put(DeviceInfo.TAG_VERSION, String.valueOf(1));
hashtable.put("man", str);
hashtable.put("keyword", str2);
hashtable.put("duration", String.valueOf(j));
hashtable.put("hash", str3);
this.f62377c.a(configKey, "http://lyrics.kugou.com/search", hashtable, new a.InterfaceC1156a() {
@Override
public void a(int i, String str4) {
if (as.f54365e) {
as.a("SearchLyricProtocol onSuccess content:" + str4);
}
if (i != 200 && i != 206) {
b.c(ApmDataEnum.APM_KTV_ACCOMPANY_LYRIC, HiAnalyticsConstant.KeyAndValue.NUMBER_01, i, true);
k.this.a(aVar, i, "", i.server);
return;
}
try {
str4 = new JSONTokener(str4).nextValue().toString();
} catch (Exception unused) {
}
try {
JSONObject jSONObject = new JSONObject(str4);
int optInt = jSONObject.optInt("status");
if (optInt != 200) {
if (optInt == 404) {
SearchLyricEntity searchLyricEntity = new SearchLyricEntity();
if (aVar != null) {
aVar.a(searchLyricEntity);
return;
}
return;
}
k.this.a(aVar, optInt, jSONObject.optString("info"), i.server);
b.b(ApmDataEnum.APM_KTV_ACCOMPANY_LYRIC, HiAnalyticsConstant.KeyAndValue.NUMBER_01, optInt, true);
return;
}
SearchLyricEntity searchLyricEntity2 = new SearchLyricEntity();
searchLyricEntity2.setStatus(optInt);
searchLyricEntity2.setInfo(jSONObject.optString("info"));
searchLyricEntity2.setKeyword(jSONObject.optString("keyword"));
searchLyricEntity2.setProposal(jSONObject.optString("proposal"));
ArrayList arrayList = new ArrayList();
JSONArray optJSONArray = jSONObject.optJSONArray("candidates");
int length = optJSONArray.length();
for (int i2 = 0; i2 < length; i2++) {
JSONObject optJSONObject = optJSONArray.optJSONObject(i2);
SearchLyricSubEntity searchLyricSubEntity = new SearchLyricSubEntity();
searchLyricSubEntity.setId(optJSONObject.optString("id"));
searchLyricSubEntity.setAccesskey(optJSONObject.optString("accesskey"));
searchLyricSubEntity.setSinger(optJSONObject.optString("singer"));
searchLyricSubEntity.setSong(optJSONObject.optString("song"));
searchLyricSubEntity.setDuration(optJSONObject.optInt("duration"));
searchLyricSubEntity.setUid(optJSONObject.optString(Oauth2AccessToken.KEY_UID));
searchLyricSubEntity.setAdjust(optJSONObject.getInt("adjust"));
searchLyricSubEntity.setScore(optJSONObject.optInt("score"));
arrayList.add(searchLyricSubEntity);
}
searchLyricEntity2.setCandidates(arrayList);
if (aVar != null) {
aVar.a(searchLyricEntity2);
}
} catch (Exception unused2) {
k.this.a(aVar, -5, "搜索失败", i.client);
}
}
@Override
public void b(int i, String str4) {
k.this.a(aVar, i, str4, i.server);
k.this.a(i);
}
});
}
public void a(a aVar, int i, String str, i iVar) {
if (aVar != null) {
aVar.a(i, str, iVar);
}
}
@Override
protected void a(int i) {
if (i == 1000404 || i == 1000502 || i == 1000302 || i == 1000303 || i == 1000304 || i == 1000307 || i == 1000401 || i == 1000403 || i == 1000407 || i == 1000503) {
b.c(ApmDataEnum.APM_KTV_ACCOMPANY_LYRIC, HiAnalyticsConstant.KeyAndValue.NUMBER_01, i - 1000000, true);
} else {
b.a(ApmDataEnum.APM_KTV_ACCOMPANY_LYRIC, HiAnalyticsConstant.KeyAndValue.NUMBER_01, i, true);
}
}
}