导航菜单

页面标题

页面副标题

MX Player v1.97.8 - c.java 源代码

正在查看: MX Player v1.97.8 应用的 c.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mxtech.subtitle.service;

import android.net.Uri;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.m.x.player.pandora.box.StatusCodeException;
import com.microsoft.identity.common.java.cache.CacheKeyValueDelegate;
import com.mxtech.subtitle.service.SubtitleService;
import com.mxtech.videoplayer.ad.online.model.bean.next.ResourceType;
import defpackage.d1j;
import defpackage.ead;
import defpackage.fab;
import defpackage.s0b;
import defpackage.shc;
import defpackage.tya;
import defpackage.xgc;
import defpackage.xve;
import defpackage.yve;
import defpackage.z4i;
import defpackage.zjg;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.concurrent.CountDownLatch;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class c extends b {
    public static final String[] m = {"User-Agent", "MX Player v1"};

    public static class a extends ead<Void, Void, yve> {
        public String a;
        public fab b;
        public String[] c;
        public xve d;

        @Override
        public final Object doInBackground(Object[] objArr) {
            fab fabVar = this.b;
            String[] strArr = this.c;
            try {
                String c = z4i.c(this.a, strArr);
                String[] strArr2 = c.m;
                Arrays.toString(strArr);
                int i = d1j.a;
                return new yve(c.F(fabVar, c));
            } catch (Exception e) {
                String[] strArr3 = c.m;
                Arrays.toString(strArr);
                e.getMessage();
                int i2 = d1j.a;
                if ((e instanceof UnknownHostException) && shc.b(tya.m)) {
                    return new yve(c.F(fabVar, "[]"));
                }
                yve yveVar = new yve();
                yveVar.a = null;
                yveVar.b = e;
                return yveVar;
            }
        }

        @Override
        public final void onCancelled() {
            super.onCancelled();
            if (this.d != null) {
                throw null;
            }
        }

        @Override
        public final void onPostExecute(Object obj) {
            yve yveVar = (yve) obj;
            super.onPostExecute(yveVar);
            xve xveVar = this.d;
            if (xveVar != null) {
                Exception exc = yveVar.b;
                if (exc != null) {
                    ((Exception[]) xveVar.b)[0] = exc;
                } else {
                    zjg[] zjgVarArr = yveVar.a;
                    if (zjgVarArr != null) {
                        ((ArrayList) xveVar.c).addAll(Arrays.asList(zjgVarArr));
                    }
                }
                ((CountDownLatch) xveVar.d).countDown();
            }
        }
    }

    public static zjg[] F(fab fabVar, String str) {
        if (TextUtils.isEmpty(str)) {
            return new zjg[0];
        }
        ArrayList arrayList = new ArrayList();
        try {
            HashSet hashSet = new HashSet();
            JSONArray jSONArray = new JSONArray(str);
            for (int i = 0; i < jSONArray.length(); i++) {
                JSONObject optJSONObject = jSONArray.optJSONObject(i);
                if (optJSONObject != null) {
                    zjg zjgVar = new zjg();
                    zjgVar.b = "opensubtitles.org";
                    zjgVar.f = optJSONObject.optString("SubFileName");
                    zjgVar.c = fabVar;
                    zjgVar.l = optJSONObject.optString("IDSubtitleFile");
                    zjgVar.g = b.C(optJSONObject.optString("SubLanguageID"));
                    zjgVar.k = optJSONObject.optString("SubDownloadLink", null);
                    zjgVar.i = b.u(optJSONObject.optString("SubRating"));
                    zjgVar.j = optJSONObject.optDouble("Score", 0.0d);
                    zjgVar.h = optJSONObject.optInt("SubSize");
                    String str2 = zjgVar.k;
                    if (str2 != null && !hashSet.contains(str2)) {
                        arrayList.add(zjgVar);
                        hashSet.add(zjgVar.k);
                    }
                }
            }
        } catch (JSONException unused) {
        }
        return (zjg[]) arrayList.toArray(new zjg[arrayList.size()]);
    }

    public static void G(@NonNull Uri.Builder builder, String str, String str2) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return;
        }
        builder.appendEncodedPath(Uri.encode(str + CacheKeyValueDelegate.CACHE_VALUE_SEPARATOR + str2));
    }

    @Override
    public final zjg[] D(fab[] fabVarArr, Locale[] localeArr, String str) throws SubtitleService.SubtitleServiceException {
        String str2;
        String str3;
        Exception exc;
        if (fabVarArr == null || fabVarArr.length <= 0) {
            return new zjg[0];
        }
        fab fabVar = fabVarArr[0];
        ArrayList arrayList = new ArrayList();
        String str4 = null;
        r4 = null;
        Locale locale = null;
        Exception[] excArr = {null};
        boolean isEmpty = TextUtils.isEmpty(null);
        String[] strArr = m;
        if (!isEmpty) {
            String[] strArr2 = new String[4];
            System.arraycopy(strArr, 0, strArr2, 0, 2);
            strArr2[2] = "Authorization";
            xgc.a(null);
            throw null;
        }
        ArrayList arrayList2 = new ArrayList();
        Uri.Builder buildUpon = Uri.parse("https://rest.opensubtitles.org/search").buildUpon();
        String f = fabVar.f();
        long g = fabVar.g();
        if (TextUtils.isEmpty(f) || g <= 0) {
            str2 = null;
        } else {
            G(buildUpon, "moviebytesize", Long.toString(g));
            G(buildUpon, "moviehash", f);
            G(buildUpon, "sublanguageid", b.y((localeArr == null || localeArr.length <= 0) ? null : localeArr[0]));
            str2 = buildUpon.build().toString();
        }
        if (!TextUtils.isEmpty(str2)) {
            arrayList2.add(str2);
        }
        Uri.Builder buildUpon2 = Uri.parse("https://rest.opensubtitles.org/search").buildUpon();
        if (TextUtils.isEmpty(str)) {
            str3 = null;
        } else {
            G(buildUpon2, "query", str);
            G(buildUpon2, "sublanguageid", b.y((localeArr == null || localeArr.length <= 0) ? null : localeArr[0]));
            str3 = buildUpon2.build().toString();
        }
        if (!TextUtils.isEmpty(str3)) {
            arrayList2.add(str3);
        }
        Uri.Builder buildUpon3 = Uri.parse("https://rest.opensubtitles.org/search").buildUpon();
        String str5 = fabVar.c;
        if (!TextUtils.isEmpty(str5)) {
            G(buildUpon3, ResourceType.TYPE_NAME_TAG, str5);
            if (localeArr != null && localeArr.length > 0) {
                locale = localeArr[0];
            }
            G(buildUpon3, "sublanguageid", b.y(locale));
            str4 = buildUpon3.build().toString();
        }
        if (!TextUtils.isEmpty(str4)) {
            arrayList2.add(str4);
        }
        CountDownLatch countDownLatch = new CountDownLatch(arrayList2.size());
        Iterator it = arrayList2.iterator();
        while (it.hasNext()) {
            String str6 = (String) it.next();
            xve xveVar = new xve(excArr, arrayList, countDownLatch);
            a aVar = new a();
            aVar.a = str6;
            aVar.b = fabVar;
            aVar.c = strArr;
            aVar.d = xveVar;
            aVar.executeOnExecutor(s0b.e(), new Void[0]);
        }
        try {
            countDownLatch.await();
        } catch (InterruptedException unused) {
        }
        if (arrayList.size() > 0 || (exc = excArr[0]) == null) {
            return (zjg[]) new HashSet(arrayList).toArray(new zjg[arrayList.size()]);
        }
        if (exc instanceof UnknownHostException) {
            throw new SubtitleService.NoNetworkException(excArr[0]);
        }
        if (!(exc instanceof StatusCodeException)) {
            throw new SubtitleService.NetworkException(excArr[0]);
        }
        int i = ((StatusCodeException) exc).b;
        if (i == 401 || i == 403) {
            throw new SubtitleService.UnauthorizedException();
        }
        throw new SubtitleService.ServerException(excArr[0]);
    }
}