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

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


package com.ss.android.article.leading.a;

import com.bytedance.news.common.service.manager.ServiceManager;
import com.bytedance.retrofit2.Call;
import com.bytedance.retrofit2.Callback;
import com.bytedance.retrofit2.SsResponse;
import com.bytedance.retrofit2.client.Header;
import com.bytedance.retrofit2.client.Request;
import com.bytedance.retrofit2.intercept.Interceptor;
import com.bytedance.retrofit2.mime.TypedByteArray;
import com.bytedance.retrofit2.mime.TypedOutput;
import com.bytedance.ttnet.utils.RetrofitUtils;
import com.google.gson.JsonObject;
import com.ss.android.article.leading.b;
import com.ss.android.article.leading.inter.IMobileSpiderService;
import com.ss.android.article.leading.net.MobileSpiderService;
import java.io.ByteArrayOutputStream;
import java.util.List;

public class a implements Interceptor {
    static {
        IMobileSpiderService iMobileSpiderService = (IMobileSpiderService) ServiceManager.getService(IMobileSpiderService.class);
        if (iMobileSpiderService != null) {
            iMobileSpiderService.initMobileSpider();
        }
    }

    @Override
    public SsResponse intercept(Interceptor.Chain chain) throws Exception {
        SsResponse proceed = chain.proceed(chain.request());
        Request request = chain.request();
        if (request != null && b.a(request.getPath())) {
            JsonObject jsonObject = new JsonObject();
            a(jsonObject, request, proceed);
            try {
                ((MobileSpiderService) RetrofitUtils.createOkService("https://6osurvos.fn.bytedance.net/", MobileSpiderService.class)).sendNetData("/query/", jsonObject).enqueue(new Callback<String>() {
                    @Override
                    public void onFailure(Call<String> call, Throwable th) {
                    }

                    @Override
                    public void onResponse(Call<String> call, SsResponse<String> ssResponse) {
                    }
                });
            } catch (Exception unused) {
            }
        }
        return proceed;
    }

    private void a(JsonObject jsonObject, SsResponse ssResponse) {
        try {
            String str = "";
            JsonObject jsonObject2 = new JsonObject();
            JsonObject jsonObject3 = new JsonObject();
            for (Header header : ssResponse.headers()) {
                jsonObject3.addProperty(header.getName(), header.getValue());
                if ("x-tt-logid".equals(header.getName())) {
                    str = header.getValue();
                }
            }
            jsonObject2.addProperty("headers", jsonObject3.toString());
            if (ssResponse.body() instanceof TypedByteArray) {
                jsonObject2.addProperty("body", new String(((TypedByteArray) ssResponse.body()).getBytes(), "utf-8"));
            } else if (ssResponse.body() instanceof String) {
                jsonObject2.addProperty("body", (String) ssResponse.body());
            } else if (ssResponse.raw().getBody() instanceof TypedByteArray) {
                jsonObject2.addProperty("body", new String(((TypedByteArray) ssResponse.raw().getBody()).getBytes(), "utf-8"));
            }
            jsonObject.add("response", jsonObject2);
            jsonObject.addProperty("logId", str);
        } catch (Exception unused) {
        }
    }

    private void a(JsonObject jsonObject, Request request) {
        try {
            JsonObject jsonObject2 = new JsonObject();
            List<Header> headers = request.getHeaders();
            JsonObject jsonObject3 = new JsonObject();
            for (Header header : headers) {
                jsonObject3.addProperty(header.getName(), header.getValue());
            }
            jsonObject2.addProperty("headers", jsonObject3.toString());
            jsonObject2.addProperty("method", request.getMethod());
            if ("POST".equals(request.getMethod())) {
                TypedOutput body = request.getBody();
                if (body instanceof TypedByteArray) {
                    jsonObject2.addProperty("body", new String(((TypedByteArray) body).getBytes(), "utf-8"));
                } else if (body != null && body.length() > 0) {
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                    body.writeTo(byteArrayOutputStream);
                    jsonObject2.addProperty("body", new String(byteArrayOutputStream.toByteArray(), "utf-8"));
                    byteArrayOutputStream.close();
                }
            }
            jsonObject2.addProperty("url", request.getUrl());
            jsonObject.add("request", jsonObject2);
        } catch (Exception unused) {
        }
    }

    private void a(JsonObject jsonObject, Request request, SsResponse ssResponse) {
        try {
            a(jsonObject, request);
            a(jsonObject, ssResponse);
            jsonObject.addProperty("appId", b.b());
            jsonObject.addProperty("did", b.c());
            jsonObject.addProperty("uid", b.d());
            jsonObject.addProperty("path", request.getPath());
        } catch (Exception unused) {
        }
    }
}