package wg3; import android.os.Build; import bw3.dt5; import bw3.e00; import bw3.f75; import bw3.h75; import bw3.i75; import bw3.k75; import bw3.m75; import bw3.mt4; import bw3.ph0; import com.eclipsesource.mmv8.Platform; import com.google.android.gms.common.Scopes; import com.google.android.gms.dynamite.ProviderConstants; import com.tencent.maas.instamovie.MJTextResolver; import com.tencent.mars.cdn.CdnLogic; import com.tencent.mm.plugin.appbrand.jsapi.storage.v; import com.tencent.mm.plugin.mmsight.segment.FFmpegMetadataRetriever; import com.tencent.mm.plugin.websearch.p; import com.tencent.mm.sdk.platformtools.BuildInfo; import com.tencent.mm.sdk.platformtools.LocaleUtil; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.MMApplicationContext; import com.tencent.mm.sdk.platformtools.NetStatusUtil; import com.tencent.mm.sdk.platformtools.Util; import com.tencent.thumbplayer.tplayer.plugins.report.TPReportKeys; import com.tencent.tmassistantsdk.downloadservice.DownloadInfo; import com.tencent.wxmm.v2helper; import com.tencent.xweb.IXWebPreferences; import com.tencent.xweb.internal.ConstValue; import gw.f; import gy3.a; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.UUID; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import vj.n; import vj.r; import vo3.b; import yv3.d; public class j { public static final h75 a(h75 h75) { h75 h752 = new h75(); h752.f23466r = h75.f23466r; h752.f23460i = h75.f23460i; h752.f23462n = h75.f23462n; h752.f23461j = h75.f23461j; h752.f23463o = h75.f23463o; h752.f23459h = h75.f23459h; h752.f23456e = h75.f23456e; h752.f23457f = h75.f23457f; h752.f23458g = h75.f23458g; h752.f23455d = h75.f23455d; h752.f23465q.addAll(h75.f23465q); h752.f23472x = h75.f23472x; h752.f23473y = h75.f23473y; h752.f23474z = h75.f23474z; return h752; } public static List<mt4> b(JSONArray jSONArray) { ArrayList arrayList = new ArrayList(); for (int i15 = 0; i15 < jSONArray.length(); i15++) { JSONObject optJSONObject = jSONArray.optJSONObject(i15); mt4 mt4 = new mt4(); mt4.f30155d = optJSONObject.optString("id", ""); mt4.f30156e = optJSONObject.optString("wording", ""); mt4.f30157f = optJSONObject.optLong("category", 0); mt4.f30158g = optJSONObject.optInt("actionType", 0); mt4.f30159h = optJSONObject.optString("url", ""); mt4.f30160i = optJSONObject.optString(FFmpegMetadataRetriever.METADATA_KEY_TITLE, ""); mt4.f30161j = optJSONObject.optString("subTitle", ""); mt4.f30162n = optJSONObject.optString("icon", ""); arrayList.add(mt4); } return arrayList; } public static String c(int i15, String str, String str2, String str3, String str4, String str5, int i16, int i17, String str6, String str7) { HashMap hashMap = new HashMap(); if (!Util.isNullOrNil(str4)) { hashMap.put("redPointMsgId", str4); } if (!Util.isNullOrNil(str)) { hashMap.put("sessionId", str); } if (!Util.isNullOrNil(str2)) { hashMap.put("query", str2); } if (!Util.isNullOrNil(str3)) { hashMap.put("requestId", str3); hashMap.put("pRequestId", str3); hashMap.put(TPReportKeys.Common.COMMON_SEQ, str3); } if (!Util.isNullOrNil(str7)) { hashMap.put("extParams", str7); } hashMap.put(TPReportKeys.PlayerStep.PLAYER_BUFFERING_SCENE, String.valueOf(i15)); if (!Util.isNullOrNil(str5)) { hashMap.put("tabInfo", str5); } if (i16 > 0) { hashMap.put("contentReddot", "" + i16); } if (i17 > 0) { hashMap.put("numberReddot", "" + i17); } hashMap.put(Scopes.PROFILE, "1"); if (!Util.isNullOrNil(str6)) { hashMap.put("homeMsgId", str6); } try { hashMap.put(MJTextResolver.KEY_DEVICE_NAME, URLEncoder.encode(d.f349173d, "utf8")); hashMap.put("deviceBrand", URLEncoder.encode(Build.BRAND, "utf8")); hashMap.put(ConstValue.INIT_CONFIG_KEY_DEVICE_MODEL, URLEncoder.encode(r.k(), "utf8")); hashMap.put("ostype", n.f327068e); } catch (UnsupportedEncodingException e15) { Log.printErrStackTrace("MicroMsg.TopStory.TopStoryApiLogic", e15, "", new Object[0]); } return d(hashMap); } public static String d(HashMap<String, String> hashMap) { hashMap.put(IXWebPreferences.XWEB_LANGUAGE, LocaleUtil.getCurrentLanguage(MMApplicationContext.getContext())); hashMap.put("platform", Platform.ANDROID); hashMap.put(ProviderConstants.API_COLNAME_FEATURE_VERSION, String.valueOf(p.g(1).s0())); hashMap.put(DownloadInfo.NETTYPE, p.c()); String str = "1"; hashMap.put("isClientLoading", str); hashMap.put("wechatVersion", BuildInfo.CLIENT_VERSION); float p15 = a.p(MMApplicationContext.getContext()); if (!(p15 == 1.0f || p15 == 0.8f || p15 == 1.1f || p15 == 1.12f || p15 == 1.125f || p15 == 1.4f || p15 == 1.55f || p15 == 1.65f)) { p15 = 1.0f; } hashMap.put("fontRatio", String.valueOf(p15)); if (!((f) yz3.j.c(f.class)).qq()) { str = "0"; } hashMap.put("showNewlife", str); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("file://"); b g15 = p.g(1); stringBuffer.append(g15.o()); stringBuffer.append("/"); stringBuffer.append(g15.f()); stringBuffer.append("?"); stringBuffer.append(p.k(hashMap)); return stringBuffer.toString(); } public static final m75 e(List<m75> list) { for (m75 m75 : list) { if (!(m75 == null || Util.isNullOrNil(m75.f29443d))) { return m75; } } return null; } public static String f() { return z80.b.i() + "topstory/homecache/"; } public static String g() { return z80.b.i() + "topstory/negcache/"; } public static String h() { return MMApplicationContext.getContext().getCacheDir() + "/topstory/"; } public static String i(String str) { return MMApplicationContext.getContext().getCacheDir() + "/topstory/" + str + "/"; } public static final boolean j(int i15) { return i15 == 110 || i15 == 700; } public static final boolean k(int i15) { return i15 == 100; } public static final boolean l(int i15) { return i15 == 666; } public static final void m(List<e00> list, String str) { if (!Util.isNullOrNil(str)) { try { JSONArray jSONArray = new JSONArray(str); for (int i15 = 0; i15 < jSONArray.length(); i15++) { JSONObject jSONObject = jSONArray.getJSONObject(i15); e00 e002 = new e00(); e002.f19923d = jSONObject.optString("key", ""); e002.f19924e = (long) jSONObject.optInt("uintValue", 0); e002.f19925f = jSONObject.optString("textValue", ""); list.add(e002); } } catch (Exception unused) { } } } public static final h75 n(dt5 dt5, int i15, String str) { h75 h75 = new h75(); h75.f23466r = UUID.randomUUID().toString(); k75 k75 = new k75(); h75.f23463o = k75; k75.f27011d = dt5.f19733n; k75.G = "video-" + dt5.f19726d; k75 k752 = h75.f23463o; k752.f27015h = dt5.f19726d; String str2 = dt5.f19744y; k752.f27013f = str2; if (Util.isNullOrNil(str2)) { h75.f23463o.f27013f = "http://shp.qpic.cn/qqvideo_ori/0/" + dt5.f19726d + String.format("_%s_%s/0", Integer.valueOf((int) v.CTRL_INDEX), Integer.valueOf((int) CdnLogic.kAppTypeNewLife)); } k75 k753 = h75.f23463o; k753.f27030y = dt5.f19731i; k753.f27025t = dt5.f19738s; k753.f27026u = dt5.f19739t; String str3 = dt5.f19727e; k753.f27029x = str3; k753.B = str3; k753.f27023r = dt5.f19736q; if (dt5.f19743x == 100203) { k753.f27016i = v2helper.VOIP_ENC_HEIGHT_LV1; k753.f27017j = 640; } else { k753.f27016i = v.CTRL_INDEX; k753.f27017j = CdnLogic.kAppTypeNewLife; } k753.E = System.currentTimeMillis(); if (!Util.isNullOrNil(dt5.f19742w)) { try { JSONArray jSONArray = new JSONArray(dt5.f19742w); for (int i16 = 0; i16 < jSONArray.length(); i16++) { JSONObject jSONObject = jSONArray.getJSONObject(i16); mt4 mt4 = new mt4(); mt4.f30155d = jSONObject.optString("id"); mt4.f30156e = jSONObject.optString("wording"); mt4.f30157f = jSONObject.optLong("category"); mt4.f30158g = jSONObject.optInt("actionType"); mt4.f30159h = jSONObject.optString("url"); mt4.f30160i = jSONObject.optString(FFmpegMetadataRetriever.METADATA_KEY_TITLE); mt4.f30161j = jSONObject.optString("subTitle"); mt4.f30162n = jSONObject.optString("icon"); h75.f23463o.D.add(mt4); } } catch (Exception unused) { } } h75.f23455d = dt5.f19726d; h75.f23456e = dt5.f19727e; h75.f23457f = dt5.f19728f; h75.f23458g = dt5.f19729g; long j15 = dt5.f19743x; h75.f23459h = j15; if (j15 <= 0) { h75.f23459h = 100201; } h75.f23468t = false; if (!Util.isNullOrNil(dt5.f19741v)) { m(h75.f23465q, dt5.f19741v); } h75.f23461j = ""; h75.f23460i = i15; h75.f23462n = str; if (!Util.isNullOrNil(dt5.f19745z)) { mt4 mt42 = new mt4(); h75.f23464p = mt42; mt42.f30160i = dt5.f19745z; } return h75; } public static final h75 o(JSONObject jSONObject) { String str; h75 h75 = new h75(); h75.f23462n = jSONObject.optString("query", ""); h75.f23460i = jSONObject.optInt(TPReportKeys.PlayerStep.PLAYER_BUFFERING_SCENE, 21); h75.f23466r = UUID.randomUUID().toString(); h75.f23457f = jSONObject.optString("searchId", ""); if (NetStatusUtil.isConnected(MMApplicationContext.getContext()) && !NetStatusUtil.isWifi(MMApplicationContext.getContext())) { h75.f23468t = true; } String optString = jSONObject.optString("videoId", ""); ArrayList arrayList = new ArrayList(); try { JSONArray jSONArray = new JSONArray(jSONObject.optString("videoUrls", "")); if (jSONArray.length() > 0) { for (int i15 = 0; i15 < jSONArray.length(); i15++) { m75 m75 = new m75(); m75.f29443d = jSONArray.getString(i15); arrayList.add(m75); } } } catch (JSONException unused) { } if (!Util.isNullOrNil(optString)) { k75 k75 = new k75(); h75.f23463o = k75; k75.f27011d = jSONObject.optString(FFmpegMetadataRetriever.METADATA_KEY_TITLE, ""); h75.f23463o.f27013f = jSONObject.optString("thumbUrl", ""); h75.f23463o.f27014g = jSONObject.optInt("mediaDuration", 0); k75 k752 = h75.f23463o; k752.f27015h = optString; k752.f27030y = jSONObject.optString("strPlayCount", ""); h75.f23463o.f27018n = jSONObject.optString("shareUrl", ""); h75.f23463o.f27019o = jSONObject.optString("shareTitle", ""); h75.f23463o.f27031z = jSONObject.optString("titleUrl", ""); h75.f23463o.f27020p = jSONObject.optString("shareDesc", ""); h75.f23463o.f27022q = jSONObject.optString("shareImgUrl", ""); h75.f23463o.f27023r = jSONObject.optString("shareString", ""); h75.f23463o.f27024s = jSONObject.optString("shareStringUrl", ""); h75.f23463o.f27025t = jSONObject.optString("source", ""); h75.f23463o.f27026u = jSONObject.optString("sourceUrl", ""); h75.f23463o.f27027v = (long) jSONObject.optInt("relevant_category", -1); h75.f23463o.f27028w = jSONObject.optString("shareOpenId", ""); h75.f23463o.G = jSONObject.optString("docID", ""); h75.f23463o.J = (long) jSONObject.optInt("videoSize", 0); h75.f23463o.E = Util.currentTicks(); h75.f23463o.A = jSONObject.optInt("itemType", 0); try { JSONObject jSONObject2 = new JSONObject(jSONObject.optString("block", "")); h75.f23463o.H = jSONObject2.optLong("resultType"); h75.f23463o.I = jSONObject2.optLong("type"); } catch (JSONException unused2) { } h75.f23463o.f27029x = jSONObject.optString("expand", ""); h75.f23463o.K.addAll(arrayList); m75 e15 = e(arrayList); if (e15 != null) { k75 k753 = h75.f23463o; k753.f27012e = e15.f29443d; k753.U = e15.f29444e; } if (Util.isNullOrNil(h75.f23463o.f27013f)) { h75.f23463o.f27013f = "http://shp.qpic.cn/qqvideo_ori/0/" + h75.f23463o.f27015h + String.format("_%s_%s/0", Integer.valueOf((int) v.CTRL_INDEX), Integer.valueOf((int) CdnLogic.kAppTypeNewLife)); } String optString2 = jSONObject.optString("tagList", ""); if (!Util.isNullOrNil(optString2)) { try { h75.f23463o.D.addAll(b(new JSONArray(optString2))); } catch (Exception unused3) { } } if (!jSONObject.optBoolean("not_show_feedback", false)) { h75.f23463o.T = new i75(); JSONObject optJSONObject = jSONObject.optJSONObject("feedbackObj"); if (optJSONObject != null) { h75.f23463o.T.f24543d = optJSONObject.optString("detailWording"); h75.f23463o.T.f24544e = optJSONObject.optString("detailUrl"); JSONArray optJSONArray = optJSONObject.optJSONArray("feedbackData"); if (optJSONArray != null) { for (int i16 = 0; i16 < optJSONArray.length(); i16++) { ph0 ph02 = new ph0(); ph02.f33019d = optJSONArray.optJSONObject(i16).optString("id", ""); ph02.f33020e = optJSONArray.optJSONObject(i16).optString("wording", ""); h75.f23463o.T.f24545f.add(ph02); } } } } String optString3 = jSONObject.optString("show_tag_list", ""); if (!Util.isNullOrNil(optString3)) { try { h75.f23463o.D.addAll(b(new JSONArray(optString3))); } catch (JSONException unused4) { } } h75.f23459h = h75.f23463o.f27027v; h75.f23456e = jSONObject.optString("expand", ""); h75.f23461j = ""; k75 k754 = h75.f23463o; h75.f23455d = k754.f27015h; k754.L = jSONObject.optInt("switchFlag", 0); k75 k755 = h75.f23463o; k755.R = jSONObject.optJSONObject("colikeInfo") != null && jSONObject.optJSONObject("colikeInfo").optBoolean("isSelfThumb"); k75 k756 = h75.f23463o; if (jSONObject.optJSONObject("colikeInfo") != null) { str = jSONObject.optJSONObject("colikeInfo").optString("byPass", ""); } else { str = ""; } k756.S = str; if (h75.f23459h == 100203) { k75 k757 = h75.f23463o; k757.f27016i = v2helper.VOIP_ENC_HEIGHT_LV1; k757.f27017j = 640; } else { k75 k758 = h75.f23463o; k758.f27016i = v.CTRL_INDEX; k758.f27017j = CdnLogic.kAppTypeNewLife; } JSONObject optJSONObject2 = jSONObject.optJSONObject("secondVideoInfo"); if (optJSONObject2 != null) { h75.f23463o.N = new f75(); h75.f23463o.N.f21332d = optJSONObject2.optInt("videoSecondType"); h75.f23463o.N.f21335g = optJSONObject2.optInt("requestDuration"); h75.f23463o.N.f21336h = optJSONObject2.optInt("requestPercent"); } String optString4 = jSONObject.optString("videoChannelTitle", ""); if (!Util.isNullOrNil(optString4)) { long j15 = h75.f23459h; if (j15 == 100202 || j15 == 100204 || j15 == 100205) { mt4 mt4 = new mt4(); h75.f23464p = mt4; mt4.f30160i = optString4; } } String optString5 = jSONObject.optString("extReqParams", ""); if (!Util.isNullOrNil(optString5)) { try { JSONArray jSONArray2 = new JSONArray(optString5); for (int i17 = 0; i17 < jSONArray2.length(); i17++) { JSONObject jSONObject3 = jSONArray2.getJSONObject(i17); e00 e002 = new e00(); e002.f19923d = jSONObject3.optString("key", ""); e002.f19924e = (long) jSONObject3.optInt("uintValue", 0); e002.f19925f = jSONObject3.optString("textValue", ""); h75.f23465q.add(e002); } } catch (Exception unused5) { } } String optString6 = jSONObject.optString("preNetType", ""); h75.f23473y = optString6; if (optString6.equals("wangka")) { h75.f23474z = 1; } else if (h75.f23473y.equals("2g") || h75.f23473y.equals("3g") || h75.f23473y.equals("4g")) { h75.f23474z = 2; } else { h75.f23474z = 0; } } return h75; } public static JSONArray p(List<mt4> list) { JSONArray jSONArray = new JSONArray(); for (int i15 = 0; i15 < list.size(); i15++) { try { JSONObject jSONObject = new JSONObject(); mt4 mt4 = list.get(i15); jSONObject.put("id", mt4.f30155d); jSONObject.put("wording", mt4.f30156e); jSONObject.put("category", mt4.f30157f); jSONObject.put("actionType", mt4.f30158g); jSONObject.put("url", mt4.f30159h); jSONObject.put(FFmpegMetadataRetriever.METADATA_KEY_TITLE, mt4.f30160i); jSONObject.put("subTitle", mt4.f30161j); jSONObject.put("icon", mt4.f30162n); jSONArray.put(jSONObject); } catch (Exception unused) { } } return jSONArray; } }