酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

以下内容为反编译后的 p.java 源代码,内容仅作参考


package com.kugou.android.app.player.comment.d;

import android.content.Context;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.kugou.android.app.KGApplication;
import com.kugou.android.app.player.comment.g.b;
import com.kugou.common.network.l;
import com.kugou.common.utils.as;
import com.kugou.common.utils.br;
import com.kugou.common.utils.bz;
import com.kugou.common.utils.ci;
import com.kugou.common.utils.cj;
import com.kugou.framework.service.util.PlaybackServiceUtil;
import com.kugou.framework.setting.operator.TingVideoADPrefs$TingVideoADKeys;
import com.sina.weibo.sdk.statistic.LogBuilder;
import com.tencent.connect.common.Constants;
import com.tencent.open.SocialConstants;
import com.tencent.stat.DeviceInfo;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import org.apache.commons.codec.net.StringEncodings;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.entity.StringEntity;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class p {

    public com.kugou.common.apm.sdk.c.a f15769a;

    public com.kugou.common.entity.e<com.kugou.android.app.player.comment.g.c> a() {
        com.kugou.common.entity.e<com.kugou.android.app.player.comment.g.c> eVar = new com.kugou.common.entity.e<>();
        a aVar = new a();
        b bVar = new b();
        try {
            com.kugou.common.network.f.d().a(aVar, bVar);
            bVar.getResponseData(eVar);
        } catch (Exception unused) {
            eVar.a(0);
        }
        return eVar;
    }

    public class a extends com.kugou.common.network.d.d {

        private JSONObject f15771b = new JSONObject();

        @Override
        public String getRequestModuleName() {
            return "comment_flow";
        }

        @Override
        public String getRequestType() {
            return Constants.HTTP_POST;
        }

        @Override
        public String getUrl() {
            return "http://ads.service.kugou.com/v2/comment_flow";
        }

        a() {
            Context context = KGApplication.getContext();
            try {
                this.f15771b.put("plat", br.E(context));
                this.f15771b.put("version", br.F(context));
                this.f15771b.put(DeviceInfo.TAG_MID, br.j(context));
                this.f15771b.put("appid", cj.g());
                this.f15771b.put("networktype", br.S(context));
                this.f15771b.put(LogBuilder.KEY_CHANNEL, br.p(context));
                this.f15771b.put("operator", br.D());
                this.f15771b.put("vip_type", com.kugou.common.environment.a.H());
                this.f15771b.put("m_type", com.kugou.common.environment.a.S());
                this.f15771b.put("phonebrand", bz.a(br.l()));
                this.f15771b.put("tags", com.kugou.common.userinfo.b.b.a().e());
                this.f15771b.put("own_ads", new JSONArray());
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("hash", PlaybackServiceUtil.getCurrentHashvalue());
                Object obj = "";
                jSONObject.put("albumid", PlaybackServiceUtil.getCurKGSong() == null ? "" : Integer.valueOf(PlaybackServiceUtil.getCurKGSong().p()));
                if (PlaybackServiceUtil.getCurKGSong() != null) {
                    obj = Long.valueOf(PlaybackServiceUtil.getCurKGSong().Q());
                }
                jSONObject.put("album_audio_id", obj);
                this.f15771b.put("song", jSONObject);
                ci.a(this.f15771b);
                ci.b(this.f15771b);
            } catch (Exception e2) {
                e2.printStackTrace();
                as.e(e2);
            }
        }

        @Override
        public HttpEntity getPostRequestEntity() {
            StringEntity stringEntity;
            try {
                stringEntity = new StringEntity(this.f15771b.toString(), StringEncodings.UTF8);
                try {
                    stringEntity.setContentType("application/json");
                } catch (UnsupportedEncodingException e2) {
                    e = e2;
                    e.printStackTrace();
                    as.e(e);
                    return stringEntity;
                }
            } catch (UnsupportedEncodingException e3) {
                e = e3;
                stringEntity = null;
            }
            return stringEntity;
        }
    }

    public class b extends com.kugou.common.apm.sdk.m<com.kugou.common.entity.e<com.kugou.android.app.player.comment.g.c>> {

        private String f15773b;

        @Override
        public void onContentException(int i, String str, int i2, byte[] bArr) {
        }

        @Override
        public void onHeaderException(int i, String str, int i2, Header[] headerArr) {
        }

        b() {
        }

        @Override
        public void setContext(byte[] bArr) {
            if (bArr == null || bArr.length <= 0) {
                return;
            }
            try {
                this.f15773b = new String(bArr, StringEncodings.UTF8);
            } catch (Exception e2) {
                as.e(e2);
            }
        }

        @Override
        public l.b getResponseType() {
            return l.b.f50583b;
        }

        @Override
        public void getResponseData(com.kugou.common.entity.e<com.kugou.android.app.player.comment.g.c> eVar) {
            try {
                JSONObject jSONObject = new JSONObject(this.f15773b);
                int optInt = jSONObject.optInt("status");
                if (optInt != 1) {
                    if (optInt == 0) {
                        int i = jSONObject.getInt("error_code");
                        eVar.b(i);
                        if (i == 0) {
                            eVar.a(1);
                            return;
                        }
                        return;
                    }
                    return;
                }
                eVar.a(1);
                if (!jSONObject.has("data") || jSONObject.isNull("data")) {
                    return;
                }
                JSONObject jSONObject2 = jSONObject.getJSONObject("data");
                com.kugou.android.app.player.comment.g.c cVar = new com.kugou.android.app.player.comment.g.c();
                cVar.a(jSONObject2.optLong("timestamp"));
                eVar.a((com.kugou.common.entity.e<com.kugou.android.app.player.comment.g.c>) cVar);
                if (jSONObject2.has("discard") && !jSONObject2.isNull("discard")) {
                    JSONArray jSONArray = jSONObject2.getJSONArray("discard");
                    ArrayList arrayList = new ArrayList();
                    for (int i2 = 0; i2 < jSONArray.length(); i2++) {
                        arrayList.add(Integer.valueOf(jSONArray.getInt(i2)));
                    }
                    cVar.b(arrayList);
                }
                if (!jSONObject2.has("ads") || jSONObject2.isNull("ads")) {
                    return;
                }
                JSONArray jSONArray2 = jSONObject2.getJSONArray("ads");
                ArrayList arrayList2 = new ArrayList(jSONArray2.length());
                for (int i3 = 0; i3 < jSONArray2.length(); i3++) {
                    JSONObject jSONObject3 = jSONArray2.getJSONObject(i3);
                    com.kugou.android.app.player.comment.g.b bVar = new com.kugou.android.app.player.comment.g.b();
                    bVar.b(jSONObject3.optInt("id"));
                    bVar.b(jSONObject3.optString("title"));
                    bVar.a(jSONObject3.optString(RemoteMessageConst.Notification.CONTENT));
                    bVar.c(jSONObject3.optInt("type", -1));
                    bVar.d(jSONObject3.optInt(TingVideoADPrefs$TingVideoADKeys.tosvip, 1));
                    p.this.a(bVar, bVar.m(), jSONObject3);
                    bVar.c(jSONObject3.optString("otherClick"));
                    bVar.a(jSONObject3.optLong("start_time") * 1000);
                    bVar.b(jSONObject3.optLong("end_time") * 1000);
                    if (jSONObject3.has("advertiser")) {
                        b.a aVar = new b.a();
                        JSONObject jSONObject4 = jSONObject3.getJSONObject("advertiser");
                        aVar.f15983b = jSONObject4.optString("avatar");
                        aVar.f15984c = jSONObject4.optString("nickname");
                        aVar.f15982a = jSONObject4.optInt("publisher");
                        bVar.a(aVar);
                    }
                    if (jSONObject3.has(SocialConstants.PARAM_SOURCE)) {
                        b.g gVar = new b.g();
                        JSONObject jSONObject5 = jSONObject3.getJSONObject(SocialConstants.PARAM_SOURCE);
                        gVar.f15992a = jSONObject5.optString("cover");
                        gVar.f15993b = jSONObject5.optString("material");
                        gVar.f15994c = jSONObject5.optInt("material_type");
                        bVar.a(gVar);
                    }
                    bVar.a(jSONObject3.optInt("rank"));
                    arrayList2.add(bVar);
                }
                cVar.a(arrayList2);
            } catch (JSONException e2) {
                as.e(e2);
            }
        }

        @Override
        public void a(com.kugou.common.apm.sdk.c.a aVar) {
            p.this.f15769a = aVar;
        }
    }

    public void a(com.kugou.android.app.player.comment.g.b bVar, int i, JSONObject jSONObject) {
        b.i iVar;
        JSONObject optJSONObject = jSONObject.optJSONObject("extra");
        switch (i) {
            case 1:
            case 2:
            case 9:
                b.i iVar2 = new b.i();
                iVar2.a(optJSONObject.optString("redirectUrl"));
                iVar = iVar2;
                break;
            case 3:
            case 5:
            case 6:
            case 7:
                ?? cVar = new b.c();
                cVar.b(optJSONObject.optInt("typeId"));
                iVar = cVar;
                break;
            case 4:
                b.d dVar = new b.d();
                dVar.a(optJSONObject.optString("redirectUrl"));
                dVar.a(optJSONObject.optInt("typeId"));
                iVar = dVar;
                break;
            case 8:
                ?? cVar2 = new b.c();
                cVar2.a(optJSONObject.optInt("fmType"));
                cVar2.b(optJSONObject.optInt("typeId"));
                iVar = cVar2;
                break;
            case 10:
            default:
                iVar = null;
                break;
            case 11:
                ?? fVar = new b.f();
                fVar.a(optJSONObject.optLong("radioDetailID"));
                fVar.a(optJSONObject.optString("radioName"));
                fVar.b(optJSONObject.optLong("radioTagID"));
                iVar = fVar;
                break;
            case 12:
                ?? eVar = new b.e();
                eVar.a(optJSONObject.optLong("radioCategoryID"));
                eVar.a(optJSONObject.optString("radioCategory"));
                iVar = eVar;
                break;
        }
        bVar.a(iVar);
    }
}