TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c

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


package com.tencent.mobileqq.structmsg;

import android.content.Context;
import android.text.TextUtils;
import com.tencent.biz.common.util.HttpUtil;
import com.tencent.mobileqq.app.DeviceProfileManager;
import com.tencent.mobileqq.app.automator.StepFactory;
import com.tencent.mobileqq.statistics.ReportController;
import com.tencent.mobileqq.structmsg.view.StructMsgItemLayout5;
import com.tencent.mobileqq.structmsg.view.StructMsgItemVideo;
import com.tencent.qphone.base.util.QLog;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.json.JSONException;
import org.json.JSONObject;
public class CGILoader {
    public static final String f92940a = "CGILoader";
    private static WeakReference f29472a = null;
    public static final String f92941b = "http://cgi.connect.qq.com/qqconnectopen/get_urlinfoForQQV2?url=%2$s&uin=%1$s";
    private static WeakReference f29473b = null;
    public static final String f92942c = "qsvideo";

    public static String a(Context context, String str, String str2) {
        Throwable th;
        String str3;
        String a2;
        String format = String.format("http://cgi.connect.qq.com/qqconnectopen/get_urlinfoForQQV2?url=%2$s&uin=%1$s", str, URLEncoder.encode(str2));
        try {
            try {
                HttpResponse a3 = HttpUtil.a(context, format, null, "GET", null, null, 10000, 10000);
                String str4 = null;
                if (a3 != null && a3.getStatusLine().getStatusCode() == 200) {
                    str4 = HttpUtil.m929a(a3);
                }
                if (TextUtils.isEmpty(str4)) {
                    throw new IOException();
                }
                String string = new JSONObject(str4).getString(f92942c);
                if (TextUtils.isEmpty(string) && QLog.isColorLevel()) {
                    QLog.e(f92940a, 2, "get video url fail:" + str2);
                }
                String a4 = a(str2);
                String str5 = TextUtils.isEmpty(string) ? "0X8005F56" : "0X8005F55";
                if (!TextUtils.isEmpty(a4)) {
                    ReportController.b(null, "dc01331", "", "", str5, str5, 0, 0, "", "", a4, "");
                }
                return string;
            } catch (Throwable th2) {
                th = th2;
                a2 = a(str2);
                String str6 = !TextUtils.isEmpty(format) ? "0X8005F56" : "0X8005F55";
                if (!TextUtils.isEmpty(a2)) {
                    ReportController.b(null, "dc01331", "", "", str6, str6, 0, 0, "", "", a2, "");
                }
                throw th;
            }
        } catch (IOException e) {
            format = "";
            QLog.e(f92940a, 1, "load video url from cgi fail", e);
            String a5 = a(str2);
            String str7 = TextUtils.isEmpty(format) ? "0X8005F56" : "0X8005F55";
            if (!TextUtils.isEmpty(a5)) {
                format = "dc01331";
                ReportController.b(null, "dc01331", "", "", str7, str7, 0, 0, "", "", a5, "");
            }
            str3 = null;
            return str3;
        } catch (JSONException e2) {
            format = "";
            QLog.e(f92940a, 1, "load video url from cgi json fail", e2);
            String a6 = a(str2);
            String str8 = TextUtils.isEmpty(format) ? "0X8005F56" : "0X8005F55";
            if (!TextUtils.isEmpty(a6)) {
                format = "dc01331";
                ReportController.b(null, "dc01331", "", "", str8, str8, 0, 0, "", "", a6, "");
            }
            str3 = null;
            return str3;
        } catch (Throwable th3) {
            format = "";
            th = th3;
            a2 = a(str2);
            if (!TextUtils.isEmpty(format)) {
            }
            if (!TextUtils.isEmpty(a2)) {
            }
            throw th;
        }
    }

    public static boolean m8167a(String str) {
        String m4231a;
        String[] strArr;
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        if (f29472a == null || f29472a.get() == null) {
            m4231a = DeviceProfileManager.m4227a().m4231a(DeviceProfileManager.DpcNames.IsEnableVideoExtraction.name());
            f29472a = new WeakReference(m4231a);
        } else {
            m4231a = (String) f29472a.get();
        }
        if ("1".equals(m4231a)) {
            if (f29473b == null || f29473b.get() == null) {
                String m4231a2 = DeviceProfileManager.m4227a().m4231a(DeviceProfileManager.DpcNames.VideoWebsiteList.name());
                if (TextUtils.isEmpty(m4231a2)) {
                    return false;
                }
                String[] split = m4231a2.substring(m4231a2.startsWith(StepFactory.f18880c) ? 1 : 0, m4231a2.endsWith(StepFactory.f18881d) ? m4231a2.length() - 1 : m4231a2.length()).split("\\|");
                if (split == null || split.length == 0) {
                    return false;
                }
                f29473b = new WeakReference(split);
                strArr = split;
            } else {
                strArr = (String[]) f29473b.get();
            }
            if (strArr == null || strArr.length == 0) {
                return false;
            }
            for (String str2 : strArr) {
                if (str.contains(str2)) {
                    return true;
                }
            }
            return false;
        }
        return false;
    }

    public static String a(String str) {
        try {
            String[] split = new URL(str).getHost().split("\\.");
            return split[split.length - 2] + "." + split[split.length - 1];
        } catch (Exception e) {
            return "";
        }
    }

    public static int a(int i) {
        if (i == 3000) {
            return 2;
        }
        return i == 1 ? 3 : 1;
    }

    public static boolean a(AbsShareMsg absShareMsg) {
        List structMsgItemLists;
        ArrayList arrayList;
        if (!(absShareMsg instanceof StructMsgForGeneralShare) || (structMsgItemLists = ((StructMsgForGeneralShare) absShareMsg).getStructMsgItemLists()) == null) {
            return false;
        }
        for (int i = 0; i < structMsgItemLists.size(); i++) {
            AbsStructMsgElement absStructMsgElement = (AbsStructMsgElement) structMsgItemLists.get(i);
            if ((absStructMsgElement instanceof StructMsgItemLayout5) && (arrayList = ((StructMsgItemLayout5) absStructMsgElement).f92934a) != null) {
                for (int i2 = 0; i2 < arrayList.size(); i2++) {
                    if (((AbsStructMsgElement) arrayList.get(i2)) instanceof StructMsgItemVideo) {
                        return true;
                    }
                }
                continue;
            }
        }
        return false;
    }
}