電視直播.apk(点击下载) / e0.java


package com.lt.plugin;

import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import com.google.gson.reflect.TypeToken;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Dns;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

/* compiled from: Http */
public final class e0 {

    /* renamed from: ʼ  reason: contains not printable characters */
    private static final OkHttpClient f3897 = new OkHttpClient.Builder().followRedirects(true).dns(new f()).build();

    /* renamed from: ʽ  reason: contains not printable characters */
    private static final Handler f3898 = new Handler(Looper.getMainLooper());

    /* renamed from: ʻ  reason: contains not printable characters */
    private final Request.Builder f3899 = new Request.Builder();

    /* access modifiers changed from: package-private */
    /* compiled from: Http */
    public class a implements Callback {

        /* renamed from: ʻ  reason: contains not printable characters */
        final /* synthetic */ c f3900;

        /* renamed from: ʼ  reason: contains not printable characters */
        final /* synthetic */ g f3901;

        a(c cVar, g gVar) {
            this.f3900 = cVar;
            this.f3901 = gVar;
        }

        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARN: Type inference failed for: r4v2, types: [java.lang.Exception] */
        /* JADX WARNING: Unknown variable types count: 1 */
        @Override // okhttp3.Callback
        public void onFailure(Call call, IOException iOException) {
            e0 e0Var = e0.this;
            c cVar = this.f3900;
            IOException iOException2 = iOException;
            if (iOException == null) {
                iOException2 = new Exception("failed");
            }
            e0Var.m4595((e0) cVar, (c) null, (Object) iOException2);
        }

        @Override // okhttp3.Callback
        public void onResponse(Call call, Response response) {
            if (response == null || !response.isSuccessful()) {
                e0.this.m4595((e0) this.f3900, (c) null, (Object) new Exception("failed resp"));
            } else {
                this.f3901.m4614(response);
            }
        }
    }

    /* compiled from: Http */
    public static class b {

        /* renamed from: ʻ  reason: contains not printable characters */
        private final FormBody.Builder f3903;

        /* synthetic */ b(a aVar) {
            this();
        }

        private b() {
            this.f3903 = new FormBody.Builder();
        }

        /* renamed from: ʻ  reason: contains not printable characters */
        public b m4609(String str, String str2) {
            this.f3903.add(str, str2);
            return this;
        }

        /* access modifiers changed from: private */
        /* access modifiers changed from: public */
        /* renamed from: ʻ  reason: contains not printable characters */
        private RequestBody m4607() {
            return this.f3903.build();
        }
    }

    /* compiled from: Http */
    public interface c<TRes> {
        /* renamed from: ʻ  reason: contains not printable characters */
        void m4610(TRes tres, Exception exc);
    }

    /* compiled from: Http */
    public static class d {

        /* renamed from: ʻ  reason: contains not printable characters */
        private final Call f3904;

        /* synthetic */ d(Call call, a aVar) {
            this(call);
        }

        /* renamed from: ʻ  reason: contains not printable characters */
        public void m4611() {
            this.f3904.cancel();
        }

        /* renamed from: ʼ  reason: contains not printable characters */
        public boolean m4612() {
            return this.f3904.isCanceled();
        }

        private d(Call call) {
            this.f3904 = call;
        }
    }

    /* compiled from: Http */
    public interface e {
        /* renamed from: ʻ  reason: contains not printable characters */
        void m4613(long j, long j2, boolean z);
    }

    /* compiled from: Http */
    private static class f implements Dns {

        /* renamed from: ʻ  reason: contains not printable characters */
        private final e.m.a.a.b f3905 = new e.m.a.a.b(e.m.a.a.f.f7654, new e.m.a.a.d[]{new e.m.a.a.i.e("223.5.5.5"), new e.m.a.a.i.e("119.29.29.29"), new e.m.a.a.i.e("223.6.6.6"), new e.m.a.a.i.e("8.8.8.8"), new e.m.a.a.i.f("https://dns.alidns.com/dns-query"), new e.m.a.a.i.f("https://1.12.12.12/dns-query")});

        f() {
        }

        @Override // okhttp3.Dns
        public List<InetAddress> lookup(String str) throws UnknownHostException {
            try {
                e.m.a.a.g[] r0 = this.f3905.m9021(str);
                if (r0 != null && r0.length > 0) {
                    ArrayList arrayList = new ArrayList(r0.length);
                    for (e.m.a.a.g gVar : r0) {
                        if (gVar != null && (gVar.m9027() || gVar.m9029())) {
                            arrayList.add(InetAddress.getByName(gVar.f7660));
                        }
                    }
                    if (arrayList.size() > 0) {
                        return arrayList;
                    }
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
            return Dns.SYSTEM.lookup(str);
        }
    }

    /* access modifiers changed from: private */
    /* compiled from: Http */
    public interface g {
        /* renamed from: ʻ  reason: contains not printable characters */
        void m4614(Response response);
    }

    private e0() {
    }

    /* renamed from: ʼ  reason: contains not printable characters */
    public static e0 m4597(String str) {
        e0 e0Var = new e0();
        e0Var.f3899.url(str).get();
        return e0Var;
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public e0 m4602(String str) {
        m4603("User-Agent", str);
        return this;
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public e0 m4603(String str, String str2) {
        this.f3899.header(str, str2);
        return this;
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* renamed from: ʻ  reason: contains not printable characters */
    private <TRes> void m4595(c<TRes> cVar, TRes tres, Exception exc) {
        if (cVar != null) {
            f3898.post(new i(cVar, tres, exc));
        }
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    private <TRes> d m4592(c<TRes> cVar, g gVar) {
        Call newCall = f3897.newCall(this.f3899.build());
        newCall.enqueue(new a(cVar, gVar));
        return new d(newCall, null);
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public <TRes> d m4599(TypeToken<TRes> typeToken, c<TRes> cVar) {
        return m4592(cVar, new j(this, typeToken, cVar));
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public /* synthetic */ void m4604(TypeToken typeToken, c cVar, Response response) {
        Object obj;
        if (response.body() != null) {
            try {
                String string = response.body().string();
                if (!TextUtils.isEmpty(string)) {
                    obj = r1.m4846(string, typeToken);
                    m4595(cVar, obj, (Exception) null);
                }
            } catch (Exception unused) {
            }
        }
        obj = null;
        m4595(cVar, obj, (Exception) null);
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public d m4600(c<byte[]> cVar) {
        return m4592(cVar, new l(this, cVar));
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public /* synthetic */ void m4606(c cVar, Response response) {
        byte[] bArr;
        if (response.body() != null) {
            try {
                bArr = response.body().bytes();
            } catch (Exception unused) {
            }
            m4595(cVar, bArr, (Exception) null);
        }
        bArr = null;
        m4595(cVar, bArr, (Exception) null);
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    private void m4594(long j, long j2, boolean z, e eVar) {
        if (eVar != null) {
            eVar.m4613(j, j2, z);
        }
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public d m4601(File file, c<File> cVar, e eVar) {
        return m4592(cVar, new k(this, cVar, file, eVar));
    }

    /* JADX WARNING: Can't wrap try/catch for region: R(21:4|(1:8)|9|10|11|12|13|14|15|16|17|18|(2:19|(1:21)(1:66))|22|(2:24|25)|26|27|28|(1:52)|53|54) */
    /* JADX WARNING: Code restructure failed: missing block: B:32:0x0080, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:33:0x0081, code lost:
        r14 = null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:34:0x0083, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:35:0x0084, code lost:
        r15 = r20;
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Missing exception handler attribute for start block: B:26:0x0077 */
    /* JADX WARNING: Removed duplicated region for block: B:32:0x0080 A[ExcHandler: all (th java.lang.Throwable), Splitter:B:11:0x003f] */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x0095 A[SYNTHETIC, Splitter:B:44:0x0095] */
    /* JADX WARNING: Removed duplicated region for block: B:48:0x009c A[SYNTHETIC, Splitter:B:48:0x009c] */
    /* JADX WARNING: Removed duplicated region for block: B:52:0x00a4  */
    /* JADX WARNING: Removed duplicated region for block: B:58:0x00ad A[SYNTHETIC, Splitter:B:58:0x00ad] */
    /* JADX WARNING: Removed duplicated region for block: B:62:0x00b4 A[SYNTHETIC, Splitter:B:62:0x00b4] */
    /* renamed from: ʻ  reason: contains not printable characters */
    public /* synthetic */ void m4605(c cVar, File file, e eVar, Response response) {
        FileOutputStream fileOutputStream;
        Throwable th;
        InputStream inputStream;
        File file2;
        Exception e2;
        InputStream inputStream2 = null;
        if (response.body() == null) {
            m4595(cVar, (Object) null, new Exception("failed response"));
            return;
        }
        if (file.getParentFile() != null && !file.getParentFile().exists()) {
            file.getParentFile().mkdirs();
        }
        try {
            long contentLength = response.body().contentLength();
            inputStream = response.body().byteStream();
            try {
                file2 = file;
                fileOutputStream = new FileOutputStream(file2);
            } catch (Exception e3) {
                e2 = e3;
                fileOutputStream = null;
                try {
                    e2.printStackTrace();
                    if (inputStream != null) {
                    }
                    if (fileOutputStream != null) {
                    }
                    if (e2 != null) {
                    }
                    m4595(cVar, file2, e2);
                } catch (Throwable th2) {
                    th = th2;
                    inputStream2 = inputStream;
                    if (inputStream2 != null) {
                    }
                    if (fileOutputStream != null) {
                    }
                    throw th;
                }
            } catch (Throwable th3) {
            }
            try {
                byte[] bArr = new byte[8192];
                long j = 0;
                while (true) {
                    int read = inputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    fileOutputStream.write(bArr, 0, read);
                    long j2 = j + ((long) read);
                    m4594(j2, contentLength, false, eVar);
                    bArr = bArr;
                    j = j2;
                }
                m4594(j, contentLength, true, eVar);
                if (inputStream != null) {
                    inputStream.close();
                }
                fileOutputStream.close();
                e2 = null;
            } catch (Exception e4) {
                e2 = e4;
                e2.printStackTrace();
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (Exception unused) {
                    }
                }
                if (fileOutputStream != null) {
                    try {
                        fileOutputStream.close();
                    } catch (Exception unused2) {
                    }
                }
                if (e2 != null) {
                }
                m4595(cVar, file2, e2);
            }
        } catch (Exception e5) {
            e2 = e5;
            file2 = file;
            inputStream = null;
            fileOutputStream = null;
            e2.printStackTrace();
            if (inputStream != null) {
            }
            if (fileOutputStream != null) {
            }
            if (e2 != null) {
            }
            m4595(cVar, file2, e2);
        } catch (Throwable th4) {
            th = th4;
            fileOutputStream = null;
            if (inputStream2 != null) {
                try {
                    inputStream2.close();
                } catch (Exception unused3) {
                }
            }
            if (fileOutputStream != null) {
                try {
                    fileOutputStream.close();
                } catch (Exception unused4) {
                }
            }
            throw th;
        }
        if (e2 != null) {
            file2 = null;
        }
        m4595(cVar, file2, e2);
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public static e0 m4593(String str, b bVar) {
        e0 e0Var = new e0();
        e0Var.f3899.url(str).post(bVar == null ? null : bVar.m4607());
        return e0Var;
    }

    /* renamed from: ʻ  reason: contains not printable characters */
    public static b m4591() {
        return new b(null);
    }
}