package defpackage;

import androidx.media3.container.NalUnitUtil;
import com.strmr.ps.data.model.tmdb.TMDBEpisode;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;

/* JADX INFO: renamed from: lc, reason: from Kotlin metadata and case insensitive filesystem */
/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\u0002\n\u0000¨\u0006\u0000"}, d2 = {"app_sideloadRelease"}, k = 2, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class C0609lc {
    public static final String a(u69 u69Var) {
        String str;
        String name;
        String source;
        List<y69> trailers = u69Var.getTrailers();
        if (trailers != null) {
            for (y69 y69Var : trailers) {
                if (cr4.b(y69Var.getType(), "Trailer") && (source = y69Var.getSource()) != null && !n89.ab(source)) {
                    return y69Var.getSource();
                }
            }
        }
        List<t69> links = u69Var.getLinks();
        if (links != null) {
            for (t69 t69Var : links) {
                if (cr4.b(t69Var.getCategory(), "trailer") || ((name = t69Var.getName()) != null && n89.l(name, "trailer", true))) {
                    String url = t69Var.getUrl();
                    if (url != null) {
                        Iterator it = y41.an("youtu\\.be/([a-zA-Z0-9_-]+)", "youtube\\.com/watch\\?v=([a-zA-Z0-9_-]+)", "youtube\\.com/embed/([a-zA-Z0-9_-]+)").iterator();
                        while (true) {
                            if (!it.hasNext()) {
                                str = null;
                                break;
                            }
                            tp5 tp5VarB = new pw7((String) it.next()).b(url);
                            if (tp5VarB != null) {
                                str = (String) tp5VarB.b().get(1);
                                break;
                            }
                        }
                        if (str != null) {
                            return str;
                        }
                    } else {
                        continue;
                    }
                }
            }
        }
        return null;
    }

    public static final TMDBEpisode b(z69 z69Var) {
        cr4.g(z69Var, "<this>");
        return new TMDBEpisode(z69Var.getId().hashCode(), z69Var.getTitle(), z69Var.getOverview(), z69Var.getReleased(), null, z69Var.getEpisode(), z69Var.getSeason(), null, null, z69Var.getThumbnail(), 256, null);
    }
}
