红果免费短剧 v6.2.3.32版本的 MD5 值为:a6b05492607eab2c8a25f26d2f238ae0

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


package com.ss.android.excitingvideo.network;

import android.util.Pair;
import com.bytedance.frameworks.baselib.network.http.util.UrlUtils;
import com.bytedance.retrofit2.Call;
import com.bytedance.retrofit2.Callback;
import com.bytedance.retrofit2.SsResponse;
import com.bytedance.retrofit2.client.Header;
import com.bytedance.ttnet.INetworkApi;
import com.bytedance.ttnet.utils.RetrofitUtils;
import com.ss.ttvideoengine.net.TTVNetClient;
import com.ss.ttvideoengine.utils.Error;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;
import org.json.JSONObject;

public class b extends TTVNetClient {

    private INetworkApi f104479a = (INetworkApi) RetrofitUtils.createSsService("https://vod-urls.bytedanceapi.com", INetworkApi.class);

    private Call<String> f104480b;

    @Override
    public void cancel() {
        Call<String> call = this.f104480b;
        if (call != null && !call.isCanceled()) {
            this.f104480b.cancel();
        }
    }

    @Override
    public void startTask(String str, TTVNetClient.CompletionListener completionListener) {
        startTask(str, null, completionListener);
    }

    @Override
    public void startTask(String str, Map<String, String> map, TTVNetClient.CompletionListener completionListener) {
        startTask(str, map, (JSONObject) null, 0, completionListener);
    }

    @Override
    public void startTask(String str, Map<String, String> map, JSONObject jSONObject, int i, final TTVNetClient.CompletionListener completionListener) {
        if (this.f104479a == null) {
            if (completionListener != null) {
                completionListener.onCompletion(null, new Error(str, -1, "mNetworkApi is null"));
                return;
            }
            return;
        }
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        try {
            Pair<String, String> parseUrl = UrlUtils.parseUrl(str, linkedHashMap);
            final String str2 = (String) parseUrl.first;
            String str3 = (String) parseUrl.second;
            LinkedList linkedList = new LinkedList();
            if (map != null && !map.isEmpty()) {
                for (Map.Entry<String, String> entry : map.entrySet()) {
                    linkedList.add(new Header(entry.getKey(), entry.getValue()));
                }
            }
            if (i == 1) {
                HashMap hashMap = new HashMap();
                if (jSONObject != null) {
                    Iterator<String> keys = jSONObject.keys();
                    while (keys.hasNext()) {
                        String next = keys.next();
                        hashMap.put(next, jSONObject.optString(next));
                    }
                }
                this.f104480b = this.f104479a.doPost(20480, str3, linkedHashMap, hashMap, linkedList, null);
            } else {
                this.f104480b = this.f104479a.doGet(true, 20480, str3, linkedHashMap, linkedList, null);
            }
            this.f104480b.enqueue(new Callback<String>() {
                @Override
                public void onFailure(Call<String> call, Throwable th) {
                    TTVNetClient.CompletionListener completionListener2 = completionListener;
                    if (completionListener2 == null) {
                        return;
                    }
                    completionListener2.onCompletion(null, new Error(str2, -1, th.getMessage()));
                }

                @Override
                public void onResponse(Call<String> call, SsResponse<String> ssResponse) {
                    TTVNetClient.CompletionListener completionListener2 = completionListener;
                    if (completionListener2 == null) {
                        return;
                    }
                    if (ssResponse == null) {
                        completionListener2.onCompletion(null, new Error(str2, -1, "null response"));
                        return;
                    }
                    if (!ssResponse.isSuccessful()) {
                        completionListener.onCompletion(null, new Error(str2, ssResponse.code(), "http fail"));
                        return;
                    }
                    try {
                        completionListener.onCompletion(new JSONObject(ssResponse.body()), null);
                    } catch (Exception e) {
                        completionListener.onCompletion(null, new Error(str2, -1, e.toString()));
                    }
                }
            });
        } catch (Exception e) {
            if (completionListener == null) {
                return;
            }
            completionListener.onCompletion(null, new Error("", -1, e.getMessage()));
        }
    }
}