Snaptube v4.40.0.4401610版本的 MD5 值为:ca2b95dcff63007195db02a6c93091b9

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


package o;

import com.snaptube.video.videoextractor.ExtractException;
import com.snaptube.video.videoextractor.model.DownloadInfo;
import com.snaptube.video.videoextractor.model.VideoInfo;
import io.fabric.sdk.android.services.settings.SettingsJsonConstants;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.json.JSONObject;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class cem extends cew {
    private static final String[] f19777 = {"/Episode/.*?\\.html", "/Video/.*?\\.html"};

    public cem() {
        super("live.cima4u.tv", f19777);
    }

    @Override
    VideoInfo mo20459(Document document, Map<String, Object> map) throws ExtractException, IOException {
        VideoInfo videoInfo = new VideoInfo();
        String m20592 = cfl.m20592(document, "div.movieSection > div.breadCrumbs > div#mpbreadcrumbs > a");
        if (cfn.m20603(m20592)) {
            videoInfo.setTitle(m20592);
            String m20596 = cfl.m20596((Element) document, "div.movieSection > div.container > div.poster > img", "src");
            String m205962 = cfl.m20596((Element) document, "div.movieSection > div.container > div.poster > img", "data-src");
            if (cfn.m20603(m20596) || cfn.m20603(m205962)) {
                if (!cfn.m20603(m20596)) {
                    m20596 = m205962;
                }
                videoInfo.setThumbnail(m20596);
            }
            return m20485(document, videoInfo);
        }
        throw new ExtractException("could not find title");
    }

    private List<DownloadInfo> m20486(String str, String str2) throws IOException, ExtractException {
        LinkedList linkedList = new LinkedList();
        JSONObject jSONObject = new JSONObject(new JSONObject(cft.m20637(cfl.m20593(Jsoup.parse(cfq.m20624(cfl.m20596((Element) Jsoup.parse(cfq.m20625(str, cfq.m20626(str2, "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"), (String) null)), "iframe", "src"), cfq.m20626(str, "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"))), "div[data-module=OKVideo]", "data-options"))).getJSONObject("flashvars").getString("metadata"));
        InputSource inputSource = new InputSource();
        inputSource.setCharacterStream(new StringReader(jSONObject.getString("metadataEmbedded")));
        try {
            NodeList elementsByTagName = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputSource).getElementsByTagName("Representation");
            for (int i = 0; i < elementsByTagName.getLength(); i++) {
                org.w3c.dom.Element element = (org.w3c.dom.Element) elementsByTagName.item(i);
                String str3 = element.getAttribute(SettingsJsonConstants.ICON_HEIGHT_KEY) + " P";
                String attribute = element.getAttribute("mimeType");
                if (!cfn.m20606(attribute)) {
                    attribute = "mp4";
                } else {
                    String[] split = attribute.trim().split("/");
                    if (split.length == 2) {
                        attribute = split[1];
                    }
                }
                NodeList elementsByTagName2 = element.getElementsByTagName("BaseURL");
                if (elementsByTagName2.getLength() != 0) {
                    String textContent = elementsByTagName2.item(0).getTextContent();
                    System.out.println(textContent);
                    linkedList.add(cfk.m20586(str3, attribute, str, textContent, m20488(textContent, str2)));
                }
            }
            return linkedList;
        } catch (ParserConfigurationException e) {
            throw new ExtractException("parse xml error", e);
        } catch (SAXException e2) {
            throw new ExtractException("parse sax error", e2);
        }
    }

    private VideoInfo m20485(Document document, VideoInfo videoInfo) throws ExtractException, IOException {
        Map<String, String> m20487 = m20487(document);
        if (m20487.isEmpty() || !m20487.containsKey("ok")) {
            throw new ExtractException("not found the source site");
        }
        videoInfo.setDownloadInfoList(m20486(m20487.get("ok"), document.baseUri()));
        return videoInfo;
    }

    private Map<String, String> m20487(Document document) {
        HashMap hashMap = new HashMap();
        Iterator<Element> it = document.select("div.watchSectionServers > div.container > div a").iterator();
        while (it.hasNext()) {
            Element next = it.next();
            hashMap.put(next.text().trim().toLowerCase(Locale.ENGLISH), "http://live.cima4u.tv/structure/server.php?id=" + next.attr("data-link"));
        }
        return hashMap;
    }

    private long m20488(String str, String str2) {
        try {
            return cfq.m20622(str, true, cfq.m20626(str2, "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19")).longValue();
        } catch (IOException e) {
            return 0L;
        }
    }
}