我的电视 v1.5.1版本的 MD5 值为:d8619c5d226c0f5dbacc4708164b48e1
以下内容为反编译后的 Request.java 源代码,内容仅作参考
package com.lizongying.mytv;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Base64;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import com.lizongying.mytv.Request;
import com.lizongying.mytv.api.ApiClient;
import com.lizongying.mytv.api.Info;
import com.lizongying.mytv.api.InfoData;
import com.lizongying.mytv.api.LiveInfo;
import com.lizongying.mytv.api.LiveInfoData;
import com.lizongying.mytv.api.LiveInfoRequest;
import com.lizongying.mytv.api.YSP;
import com.lizongying.mytv.api.YSPApiService;
import com.lizongying.mytv.api.YSPBtraceService;
import com.lizongying.mytv.api.YSPProtoService;
import com.lizongying.mytv.api.YSPTokenService;
import com.lizongying.mytv.models.TVViewModel;
import com.lizongying.mytv.proto.Ysp;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import kotlin.Metadata;
import kotlin.TuplesKt;
import kotlin.collections.ArraysKt;
import kotlin.collections.MapsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.MatchResult;
import kotlin.text.Regex;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Metadata(d1 = {"\u0000t\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010$\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u0000 12\u00020\u0001:\u0003012B\u0005¢\u0006\u0002\u0010\u0002J\u0018\u0010\u001e\u001a\u00020\u00102\u0006\u0010\u001f\u001a\u00020 2\u0006\u0010!\u001a\u00020 H\u0002J\u000e\u0010\"\u001a\u00020#2\u0006\u0010$\u001a\u00020%J\u000e\u0010&\u001a\u00020#2\u0006\u0010$\u001a\u00020%J\u0006\u0010'\u001a\u00020#J\u000e\u0010(\u001a\u00020#2\u0006\u0010)\u001a\u00020%J\u0006\u0010*\u001a\u00020#J\u000e\u0010+\u001a\u00020#2\u0006\u0010$\u001a\u00020%J\u0016\u0010+\u001a\u00020#2\u0006\u0010$\u001a\u00020%2\u0006\u0010,\u001a\u00020\u0010J\u000e\u0010-\u001a\u00020#2\u0006\u0010.\u001a\u00020/R\u0012\u0010\u0003\u001a\u00060\u0004R\u00020\u0000X\u0082.¢\u0006\u0002\n\u0000R\"\u0010\u0005\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\b\u0010\t\"\u0004\b\n\u0010\u000bR\u000e\u0010\f\u001a\u00020\rX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u000e\u001a\u000e\u0012\u0004\u0012\u00020\u0010\u0012\u0004\u0012\u00020\u00100\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0010X\u0082\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u0012\u001a\u00060\u0013R\u00020\u0000X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0014\u001a\u0004\u0018\u00010\u0015X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u0017X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0018\u001a\u00020\u0019X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u001a\u001a\u00020\u001bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u001c\u001a\u00020\u001dX\u0082\u000e¢\u0006\u0002\n\u0000¨\u00063"}, d2 = {"Lcom/lizongying/mytv/Request;", "", "()V", "btraceRunnable", "Lcom/lizongying/mytv/Request$BtraceRunnable;", NotificationCompat.CATEGORY_CALL, "Lretrofit2/Call;", "Lcom/lizongying/mytv/api/LiveInfo;", "getCall", "()Lretrofit2/Call;", "setCall", "(Lretrofit2/Call;)V", "handler", "Landroid/os/Handler;", "mapping", "", "", "token", "tokenRunnable", "Lcom/lizongying/mytv/Request$TokenRunnable;", "ysp", "Lcom/lizongying/mytv/api/YSP;", "yspApiService", "Lcom/lizongying/mytv/api/YSPApiService;", "yspBtraceService", "Lcom/lizongying/mytv/api/YSPBtraceService;", "yspProtoService", "Lcom/lizongying/mytv/api/YSPProtoService;", "yspTokenService", "Lcom/lizongying/mytv/api/YSPTokenService;", "encryptTripleDES", "key", "", "iv", "fetchBtrace", "", "tvModel", "Lcom/lizongying/mytv/models/TVViewModel;", "fetchData", "fetchPage", "fetchProgram", "tvViewModel", "fetchToken", "fetchVideo", "cookie", "initYSP", "context", "Landroid/content/Context;", "BtraceRunnable", "Companion", "TokenRunnable", "app_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class Request {
private static final String TAG = "Request";
private BtraceRunnable btraceRunnable;
private Call<LiveInfo> call;
private final Handler handler;
private Map<String, String> mapping;
private TokenRunnable tokenRunnable;
private YSP ysp;
private YSPTokenService yspTokenService = new ApiClient().getYspTokenService();
private YSPApiService yspApiService = new ApiClient().getYspApiService();
private YSPBtraceService yspBtraceService = new ApiClient().getYspBtraceService();
private YSPProtoService yspProtoService = new ApiClient().getYspProtoService();
private String token = "";
public final Call<LiveInfo> getCall() {
return this.call;
}
public final void setCall(Call<LiveInfo> call) {
this.call = call;
}
public Request() {
Handler handler = new Handler(Looper.getMainLooper());
this.handler = handler;
this.tokenRunnable = new TokenRunnable();
this.mapping = MapsKt.mapOf(TuplesKt.to("CCTV4K", "CCTV4K 超高清"), TuplesKt.to("CCTV1", "CCTV1 综合"), TuplesKt.to("CCTV2", "CCTV2 财经"), TuplesKt.to("CCTV4", "CCTV4 中文国际"), TuplesKt.to("CCTV5", "CCTV5 体育"), TuplesKt.to("CCTV5+", "CCTV5+ 体育赛事"), TuplesKt.to("CCTV7", "CCTV7 国防军事"), TuplesKt.to("CCTV9", "CCTV9 记录"), TuplesKt.to("CCTV10", "CCTV10 科教"), TuplesKt.to("CCTV11", "CCTV11 戏曲"), TuplesKt.to("CCTV12", "CCTV12 社会与法"), TuplesKt.to("CCTV13", "CCTV13 新闻"), TuplesKt.to("CCTV14", "CCTV14 少儿"), TuplesKt.to("CCTV15", "CCTV15 音乐"), TuplesKt.to("CCTV16-HD", "CCTV16 奥林匹克"), TuplesKt.to("CCTV17", "CCTV17 农业农村"), TuplesKt.to("CGTN", "CGTN"), TuplesKt.to("CGTN法语频道", "CGTN 法语频道"), TuplesKt.to("CGTN俄语频道", "CGTN 俄语频道"), TuplesKt.to("CGTN阿拉伯语频道", "CGTN 阿拉伯语频道"), TuplesKt.to("CGTN西班牙语频道", "CGTN 西班牙语频道"), TuplesKt.to("CGTN外语纪录频道", "CGTN 纪录频道"), TuplesKt.to("东方卫视", "东方卫视"), TuplesKt.to("湖南卫视", "湖南卫视"), TuplesKt.to("湖北卫视", "湖北卫视"), TuplesKt.to("辽宁卫视", "辽宁卫视"), TuplesKt.to("江苏卫视", "江苏卫视"), TuplesKt.to("江西卫视", "江西卫视"), TuplesKt.to("山东卫视", "山东卫视"), TuplesKt.to("广东卫视", "广东卫视"), TuplesKt.to("广西卫视", "广西卫视"), TuplesKt.to("重庆卫视", "重庆卫视"), TuplesKt.to("河南卫视", "河南卫视"), TuplesKt.to("河北卫视", "河北卫视"), TuplesKt.to("贵州卫视", "贵州卫视"), TuplesKt.to("北京卫视", "北京卫视"), TuplesKt.to("黑龙江卫视", "黑龙江卫视"), TuplesKt.to("浙江卫视", "浙江卫视"), TuplesKt.to("安徽卫视", "安徽卫视"), TuplesKt.to("深圳卫视", "深圳卫视"), TuplesKt.to("四川卫视", "四川卫视"), TuplesKt.to("福建东南卫视", "东南卫视"), TuplesKt.to("海南卫视", "海南卫视"), TuplesKt.to("天津卫视", "天津卫视"), TuplesKt.to("新疆卫视", "新疆卫视"));
handler.post(this.tokenRunnable);
}
public final void initYSP(Context context) {
Intrinsics.checkNotNullParameter(context, "context");
this.ysp = new YSP(context);
}
public final void fetchVideo(final TVViewModel tvModel, final String cookie) {
Intrinsics.checkNotNullParameter(tvModel, "tvModel");
Intrinsics.checkNotNullParameter(cookie, "cookie");
Call<LiveInfo> call = this.call;
if (call != null) {
call.cancel();
}
BtraceRunnable btraceRunnable = this.btraceRunnable;
Call<LiveInfo> call2 = null;
if (btraceRunnable != null) {
Handler handler = this.handler;
if (btraceRunnable == null) {
Intrinsics.throwUninitializedPropertyAccessException("btraceRunnable");
btraceRunnable = null;
}
handler.removeCallbacks(btraceRunnable);
}
final String value = tvModel.getTitle().getValue();
tvModel.setSeq(0);
YSP ysp = this.ysp;
String m558switch = ysp != null ? ysp.m558switch(tvModel) : null;
final LiveInfoRequest liveInfoRequest = m558switch != null ? new LiveInfoRequest(m558switch) : null;
if (liveInfoRequest != null) {
YSPApiService ySPApiService = this.yspApiService;
YSP ysp2 = this.ysp;
call2 = ySPApiService.getLiveInfo("guid=" + (ysp2 != null ? ysp2.getGuid() : null) + "; " + cookie, liveInfoRequest);
}
this.call = call2;
if (call2 != null) {
call2.enqueue(new Callback<LiveInfo>() {
@Override
public void onResponse(Call<LiveInfo> call3, Response<LiveInfo> response) {
LiveInfoData data;
String encryptTripleDES;
Object obj;
LiveInfoData data2;
Intrinsics.checkNotNullParameter(call3, "call");
Intrinsics.checkNotNullParameter(response, "response");
if (response.isSuccessful()) {
LiveInfo body = response.body();
Object obj2 = null;
if (((body == null || (data2 = body.getData()) == null) ? null : data2.getPlayurl()) == null) {
if (body != null && (data = body.getData()) != null) {
obj2 = data.getErrinfo();
}
if (obj2 != null && Intrinsics.areEqual(body.getData().getErrinfo(), "应版权方要求,暂停提供直播信号,请点击观看其他精彩节目")) {
Log.e("Request", value + " error " + body.getData().getErrinfo());
tvModel.setErrInfo(body.getData().getErrinfo());
return;
}
Log.e("Request", value + " url error " + liveInfoRequest + " " + body);
if (tvModel.getRetryTimes() < tvModel.getRetryMaxTimes()) {
TVViewModel tVViewModel = tvModel;
tVViewModel.setRetryTimes(tVViewModel.getRetryTimes() + 1);
if (tvModel.getNeedToken()) {
Request.this.token = "";
Request.this.fetchVideo(tvModel);
return;
} else {
Request.this.fetchVideo(tvModel, cookie);
return;
}
}
return;
}
String substring = body.getData().getChanll().substring(9, r3.length() - 3);
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
byte[] decode = Base64.decode(substring, 0);
Intrinsics.checkNotNull(decode);
MatchResult find$default = Regex.find$default(new Regex("des_key = \"([^\"]+).+var des_iv = \"([^\"]+)"), new String(decode, Charsets.UTF_8), 0, 2, null);
if (find$default != null) {
MatchResult.Destructured destructured = find$default.getDestructured();
String str = destructured.getMatch().getGroupValues().get(1);
String str2 = destructured.getMatch().getGroupValues().get(2);
byte[] decode2 = Base64.decode(str, 0);
byte[] decode3 = Base64.decode(str2, 0);
String playurl = body.getData().getPlayurl();
Request request = Request.this;
Intrinsics.checkNotNull(decode2);
byte[] plus = ArraysKt.plus(decode2, new byte[]{0, 0, 0, 0, 0, 0, 0, 0});
Intrinsics.checkNotNull(decode3);
encryptTripleDES = request.encryptTripleDES(plus, decode3);
String upperCase = encryptTripleDES.toUpperCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(upperCase, "toUpperCase(...)");
String str3 = playurl + "&revoi=" + upperCase;
Log.d("Request", value + " url " + str3);
tvModel.addVideoUrl(str3);
tvModel.allReady();
tvModel.setRetryTimes(0);
Request.this.btraceRunnable = new Request.BtraceRunnable(Request.this, tvModel);
Handler handler2 = Request.this.handler;
obj = Request.this.btraceRunnable;
if (obj == null) {
Intrinsics.throwUninitializedPropertyAccessException("btraceRunnable");
} else {
obj2 = obj;
}
handler2.post((Runnable) obj2);
return;
}
Log.e("Request", value + " key error");
if (tvModel.getRetryTimes() < tvModel.getRetryMaxTimes()) {
TVViewModel tVViewModel2 = tvModel;
tVViewModel2.setRetryTimes(tVViewModel2.getRetryTimes() + 1);
if (tvModel.getNeedToken()) {
Request.this.token = "";
Request.this.fetchVideo(tvModel);
return;
} else {
Request.this.fetchVideo(tvModel, cookie);
return;
}
}
return;
}
Log.e("Request", value + " status error");
if (tvModel.getRetryTimes() < tvModel.getRetryMaxTimes()) {
TVViewModel tVViewModel3 = tvModel;
tVViewModel3.setRetryTimes(tVViewModel3.getRetryTimes() + 1);
if (tvModel.getNeedToken()) {
Request.this.token = "";
Request.this.fetchVideo(tvModel);
} else {
Request.this.fetchVideo(tvModel, cookie);
}
}
}
@Override
public void onFailure(Call<LiveInfo> call3, Throwable t) {
Intrinsics.checkNotNullParameter(call3, "call");
Intrinsics.checkNotNullParameter(t, "t");
Log.e("Request", value + " request error");
if (tvModel.getRetryTimes() < tvModel.getRetryMaxTimes()) {
TVViewModel tVViewModel = tvModel;
tVViewModel.setRetryTimes(tVViewModel.getRetryTimes() + 1);
if (tvModel.getNeedToken()) {
Request.this.token = "";
Request.this.fetchVideo(tvModel);
} else {
Request.this.fetchVideo(tvModel, cookie);
}
}
}
});
}
}
public final void fetchVideo(final TVViewModel tvModel) {
Intrinsics.checkNotNullParameter(tvModel, "tvModel");
if (Intrinsics.areEqual(this.token, "")) {
this.yspTokenService.getInfo().enqueue(new Callback<Info>() {
@Override
public void onResponse(Call<Info> call, Response<Info> response) {
String str;
String str2;
InfoData data;
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
if (response.isSuccessful()) {
Request request = Request.this;
Info body = response.body();
String token = (body == null || (data = body.getData()) == null) ? null : data.getToken();
Intrinsics.checkNotNull(token);
request.token = token;
str = Request.this.token;
Log.i("Request", "info success " + str);
str2 = Request.this.token;
Request.this.fetchVideo(tvModel, "vplatform=109; yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=" + str2);
return;
}
Log.e("Request", "info status error");
if (tvModel.getRetryTimes() < tvModel.getRetryMaxTimes()) {
TVViewModel tVViewModel = tvModel;
tVViewModel.setRetryTimes(tVViewModel.getRetryTimes() + 1);
Request.this.fetchVideo(tvModel);
}
}
@Override
public void onFailure(Call<Info> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Log.e("Request", "info request error " + t);
if (tvModel.getRetryTimes() < tvModel.getRetryMaxTimes()) {
TVViewModel tVViewModel = tvModel;
tVViewModel.setRetryTimes(tVViewModel.getRetryTimes() + 1);
Request.this.fetchVideo(tvModel);
}
}
});
return;
}
fetchVideo(tvModel, "vplatform=109; yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=" + this.token);
}
public final void fetchData(TVViewModel tvModel) {
Intrinsics.checkNotNullParameter(tvModel, "tvModel");
if (tvModel.getNeedToken()) {
fetchVideo(tvModel);
} else {
fetchVideo(tvModel, "vplatform=109");
}
}
@Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\b\u0086\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0016¨\u0006\u0005"}, d2 = {"Lcom/lizongying/mytv/Request$TokenRunnable;", "Ljava/lang/Runnable;", "(Lcom/lizongying/mytv/Request;)V", "run", "", "app_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class TokenRunnable implements Runnable {
public TokenRunnable() {
}
@Override
public void run() {
Request.this.fetchToken();
Request.this.handler.postDelayed(this, 600000L);
}
}
public final void fetchToken() {
this.yspTokenService.getInfo().enqueue(new Callback<Info>() {
@Override
public void onResponse(Call<Info> call, Response<Info> response) {
String str;
InfoData data;
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
if (response.isSuccessful()) {
Request request = Request.this;
Info body = response.body();
String token = (body == null || (data = body.getData()) == null) ? null : data.getToken();
Intrinsics.checkNotNull(token);
request.token = token;
str = Request.this.token;
Log.i("Request", "info success " + str);
return;
}
Log.e("Request", "token status error");
}
@Override
public void onFailure(Call<Info> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Log.e("Request", "token request error " + t);
}
});
}
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\b\u0086\u0004\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u0005\u001a\u00020\u0006H\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0007"}, d2 = {"Lcom/lizongying/mytv/Request$BtraceRunnable;", "Ljava/lang/Runnable;", "tvModel", "Lcom/lizongying/mytv/models/TVViewModel;", "(Lcom/lizongying/mytv/Request;Lcom/lizongying/mytv/models/TVViewModel;)V", "run", "", "app_release"}, k = 1, mv = {1, 9, 0}, xi = 48)
public final class BtraceRunnable implements Runnable {
final Request this$0;
private final TVViewModel tvModel;
public BtraceRunnable(Request request, TVViewModel tvModel) {
Intrinsics.checkNotNullParameter(tvModel, "tvModel");
this.this$0 = request;
this.tvModel = tvModel;
}
@Override
public void run() {
this.this$0.fetchBtrace(this.tvModel);
this.this$0.handler.postDelayed(this, 60000L);
}
}
public final void fetchBtrace(TVViewModel tvModel) {
Intrinsics.checkNotNullParameter(tvModel, "tvModel");
final String value = tvModel.getTitle().getValue();
YSP ysp = this.ysp;
String guid = ysp != null ? ysp.getGuid() : null;
Intrinsics.checkNotNull(guid);
String value2 = tvModel.getPid().getValue();
Intrinsics.checkNotNull(value2);
String str = value2;
String value3 = tvModel.getSid().getValue();
Intrinsics.checkNotNull(value3);
String str2 = value3;
YSPBtraceService ySPBtraceService = this.yspBtraceService;
YSP ysp2 = this.ysp;
String generateGuid = ysp2 != null ? ysp2.generateGuid() : null;
Intrinsics.checkNotNull(generateGuid);
String str3 = "https://www.yangshipin.cn/#/tv/home?pid=" + str;
YSP ysp3 = this.ysp;
String rand = ysp3 != null ? ysp3.getRand() : null;
Intrinsics.checkNotNull(rand);
YSPBtraceService.DefaultImpls.kvcollect$default(ySPBtraceService, null, generateGuid, null, str, str, null, Utils.INSTANCE.getDateFormat("yyyy-MM-dd HH:mm:ss"), str2, rand, guid, null, null, null, null, str3, String.valueOf(tvModel.getSeq()), null, null, null, null, null, null, null, null, null, null, null, str2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, guid, null, -134267867, 196607, null).enqueue(new Callback<Void>() {
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
if (response.isSuccessful()) {
return;
}
Log.e("Request", value + " kvcollect status error");
}
@Override
public void onFailure(Call<Void> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Log.e("Request", value + " kvcollect request error");
}
});
tvModel.setSeq(tvModel.getSeq() + 1);
}
public final void fetchPage() {
this.yspProtoService.getPage().enqueue(new Callback<Ysp.cn.yangshipin.oms.common.proto.pageModel.Response>() {
@Override
public void onResponse(Call<Ysp.cn.yangshipin.oms.common.proto.pageModel.Response> call, Response<Ysp.cn.yangshipin.oms.common.proto.pageModel.Response> response) {
Ysp.cn.yangshipin.oms.common.proto.pageModel.Response body;
Ysp.cn.yangshipin.oms.common.proto.pageModel.Data data;
Map map;
TV tv;
Object obj;
Map map2;
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
if (!response.isSuccessful() || (body = response.body()) == null || (data = body.getData()) == null || data.getFeedModuleListCount() != 1) {
return;
}
Ysp.cn.yangshipin.oms.common.proto.pageModel.Data data2 = body.getData();
List<Ysp.cn.yangshipin.oms.common.proto.pageModel.Module> feedModuleListList = data2 != null ? data2.getFeedModuleListList() : null;
Intrinsics.checkNotNull(feedModuleListList);
Ysp.cn.yangshipin.oms.common.proto.pageModel.Module module = feedModuleListList.get(0);
List<Ysp.cn.yangshipin.oms.common.proto.tvChannelListModel.TvChannelListData> dataTvChannelListList = module != null ? module.getDataTvChannelListList() : null;
Intrinsics.checkNotNull(dataTvChannelListList);
Iterator<Ysp.cn.yangshipin.oms.common.proto.tvChannelListModel.TvChannelListData> it = dataTvChannelListList.iterator();
while (it.hasNext()) {
Ysp.cn.yangshipin.oms.common.proto.tvChannelListModel.TvChannelListData next = it.next();
if (!next.getIsVip() || next.getIsLimitedFree()) {
Log.i("Request", next.getChannelName() + "," + next.getPid() + "," + next.getStreamId());
String str = (next != null ? next.getChannelType() : null) == "weishi" ? "地方频道" : "央视频道";
map = Request.this.mapping;
if (map.containsKey(next.getChannelName())) {
List<TV> list = TVList.INSTANCE.getList().get(str);
if (list != null) {
Request request = Request.this;
Iterator<T> it2 = list.iterator();
while (true) {
if (!it2.hasNext()) {
obj = null;
break;
}
obj = it2.next();
String title = ((TV) obj).getTitle();
map2 = request.mapping;
if (Intrinsics.areEqual(title, map2.get(next.getChannelName()))) {
break;
}
}
tv = (TV) obj;
} else {
tv = null;
}
if (tv != null) {
String tvLogo = next.getTvLogo();
Intrinsics.checkNotNullExpressionValue(tvLogo, "getTvLogo(...)");
tv.setLogo(tvLogo);
String pid = next.getPid();
Intrinsics.checkNotNullExpressionValue(pid, "getPid(...)");
tv.setPid(pid);
String streamId = next.getStreamId();
Intrinsics.checkNotNullExpressionValue(streamId, "getStreamId(...)");
tv.setSid(streamId);
}
}
}
}
}
@Override
public void onFailure(Call<Ysp.cn.yangshipin.oms.common.proto.pageModel.Response> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Log.e("Request", "Page request failed", t);
}
});
}
public final void fetchProgram(final TVViewModel tvViewModel) {
Intrinsics.checkNotNullParameter(tvViewModel, "tvViewModel");
final String value = tvViewModel.getTitle().getValue();
YSPProtoService ySPProtoService = this.yspProtoService;
String value2 = tvViewModel.getProgramId().getValue();
Intrinsics.checkNotNull(value2);
ySPProtoService.getProgram(value2, Utils.INSTANCE.getDateFormat("yyyyMMdd")).enqueue(new Callback<Ysp.cn.yangshipin.omstv.common.proto.epgProgramModel.Response>() {
@Override
public void onResponse(Call<Ysp.cn.yangshipin.omstv.common.proto.epgProgramModel.Response> call, Response<Ysp.cn.yangshipin.omstv.common.proto.epgProgramModel.Response> response) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
if (response.isSuccessful()) {
Ysp.cn.yangshipin.omstv.common.proto.epgProgramModel.Response body = response.body();
if (body != null) {
TVViewModel tVViewModel = TVViewModel.this;
List<Ysp.cn.yangshipin.omstv.common.proto.programModel.Program> dataListList = body.getDataListList();
Intrinsics.checkNotNullExpressionValue(dataListList, "getDataListList(...)");
tVViewModel.addProgram(dataListList);
Log.i("Request", value + " program " + body.getDataListList().size());
return;
}
return;
}
Log.w("Request", value + " program error");
}
@Override
public void onFailure(Call<Ysp.cn.yangshipin.omstv.common.proto.epgProgramModel.Response> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Log.e("Request", value + " program request failed " + t);
}
});
}
public final String encryptTripleDES(byte[] key, byte[] iv) {
try {
SecretKeySpec secretKeySpec = new SecretKeySpec(key, "DESede");
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
Cipher cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding");
cipher.init(1, secretKeySpec, ivParameterSpec);
byte[] bytes = "{\"mver\":\"1\",\"subver\":\"1.2\",\"host\":\"www.yangshipin.cn/#/tv/home?pid=\",\"referer\":\"\",\"canvas\":\"YSPANGLE(Apple,AppleM1Pro,OpenGL4.1)\"}".getBytes(Charsets.UTF_8);
Intrinsics.checkNotNullExpressionValue(bytes, "getBytes(...)");
byte[] doFinal = cipher.doFinal(bytes);
Intrinsics.checkNotNull(doFinal);
return ArraysKt.joinToString$default(doFinal, (CharSequence) "", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) new Function1<Byte, CharSequence>() {
public final CharSequence invoke(byte b) {
String format = String.format("%02x", Arrays.copyOf(new Object[]{Byte.valueOf(b)}, 1));
Intrinsics.checkNotNullExpressionValue(format, "format(...)");
return format;
}
@Override
public CharSequence invoke(Byte b) {
return invoke(b.byteValue());
}
}, 30, (Object) null);
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
}