APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Music Player
版本号:1.0
包名称:music.downloader.mp3player.downloadmusic

MD5 校验值:61e58c10a11e4adec8760ee3854e996a

反编译源代码说明

YoutubeStreamLinkHandlerFactory.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package org.schabi.newpipe.extractor.services.youtube.linkHandler;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.http.message.TokenParser;
import org.schabi.newpipe.extractor.exceptions.FoundAdException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper;
import org.schabi.newpipe.extractor.utils.Utils;
import p4.r;

public final class YoutubeStreamLinkHandlerFactory extends LinkHandlerFactory {
    private static final List<String> SUBPATHS;
    private static final Pattern YOUTUBE_VIDEO_ID_REGEX_PATTERN = Pattern.compile("^([a-zA-Z0-9_-]{11})");
    private static final YoutubeStreamLinkHandlerFactory INSTANCE = new YoutubeStreamLinkHandlerFactory();

    static {
        Object[] objArr = {"embed/", "live/", "shorts/", "watch/", "v/", "w/"};
        ArrayList arrayList = new ArrayList(6);
        for (int i5 = 0; i5 < 6; i5++) {
            Object obj = objArr[i5];
            Objects.requireNonNull(obj);
            arrayList.add(obj);
        }
        SUBPATHS = Collections.unmodifiableList(arrayList);
    }

    private YoutubeStreamLinkHandlerFactory() {
    }

    private static String assertIsId(String str) {
        String extractId = extractId(str);
        if (extractId != null) {
            return extractId;
        }
        throw new ParsingException("The given string is not a YouTube video ID");
    }

    private static String extractId(String str) {
        if (str == null) {
            return null;
        }
        Matcher matcher = YOUTUBE_VIDEO_ID_REGEX_PATTERN.matcher(str);
        if (matcher.find()) {
            return matcher.group(1);
        }
        return null;
    }

    private String getIdFromSubpathsInPath(String str) {
        for (String str2 : SUBPATHS) {
            if (str.startsWith(str2)) {
                return assertIsId(str.substring(str2.length()));
            }
        }
        return null;
    }

    public static YoutubeStreamLinkHandlerFactory getInstance() {
        return INSTANCE;
    }

    @Override
    public String getId(String str) {
        String queryValue;
        char c7 = 2;
        try {
            URI uri = new URI(str);
            String scheme = uri.getScheme();
            if (scheme != null && (scheme.equals("vnd.youtube") || scheme.equals("vnd.youtube.launch"))) {
                String schemeSpecificPart = uri.getSchemeSpecificPart();
                if (schemeSpecificPart.startsWith("//")) {
                    String extractId = extractId(schemeSpecificPart.substring(2));
                    if (extractId != null) {
                        return extractId;
                    }
                    str = "https:".concat(schemeSpecificPart);
                } else {
                    return assertIsId(schemeSpecificPart);
                }
            }
        } catch (URISyntaxException unused) {
        }
        try {
            URL stringToURL = Utils.stringToURL(str);
            String host = stringToURL.getHost();
            String path = stringToURL.getPath();
            if (!path.isEmpty()) {
                path = path.substring(1);
            }
            if (Utils.isHTTP(stringToURL) && (YoutubeParsingHelper.isYoutubeURL(stringToURL) || YoutubeParsingHelper.isYoutubeServiceURL(stringToURL) || YoutubeParsingHelper.isHooktubeURL(stringToURL) || YoutubeParsingHelper.isInvidiousURL(stringToURL) || YoutubeParsingHelper.isY2ubeURL(stringToURL))) {
                if (!YoutubePlaylistLinkHandlerFactory.getInstance().acceptUrl(str)) {
                    String upperCase = host.toUpperCase();
                    upperCase.getClass();
                    switch (upperCase.hashCode()) {
                        case -2114213841:
                            if (upperCase.equals("INVIDIOUS.ZEE.LI")) {
                                c7 = 0;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -2087592960:
                            if (upperCase.equals("TUBUS.EDUVID.ORG")) {
                                c7 = 1;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -1698218251:
                            break;
                        case -1693444139:
                            if (upperCase.equals("M.YOUTUBE.COM")) {
                                c7 = 3;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -1604112842:
                            if (upperCase.equals("YT.CYBERHOST.UK")) {
                                c7 = 4;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -1416474788:
                            if (upperCase.equals("VID.MINT.LGBT")) {
                                c7 = 5;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -1146372515:
                            if (upperCase.equals("YTB.TROM.TF")) {
                                c7 = 6;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -1141849304:
                            if (upperCase.equals("VID.PUFFYAN.US")) {
                                c7 = 7;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -1092206675:
                            if (upperCase.equals("PIPED.KAVIN.ROCKS")) {
                                c7 = '\b';
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -827318675:
                            if (upperCase.equals("INVIDIOUS.NAMAZSO.EU")) {
                                c7 = '\t';
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -397809965:
                            if (upperCase.equals("DEV.INVIDIO.US")) {
                                c7 = '\n';
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -397058810:
                            if (upperCase.equals("INV.RIVERSIDE.ROCKS")) {
                                c7 = 11;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -244508014:
                            if (upperCase.equals("INVIDIOU.SITE")) {
                                c7 = '\f';
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -124567835:
                            if (upperCase.equals("YEWTU.BE")) {
                                c7 = TokenParser.CR;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case -52807283:
                            if (upperCase.equals("MUSIC.YOUTUBE.COM")) {
                                c7 = 14;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 73534791:
                            if (upperCase.equals("INVIDIOUS.KAVIN.ROCKS")) {
                                c7 = 15;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 103116914:
                            if (upperCase.equals("INVIDIOUS-US.KAVIN.ROCKS")) {
                                c7 = 16;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 103276081:
                            if (upperCase.equals("YOUTU.BE")) {
                                c7 = 17;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 169254170:
                            if (upperCase.equals("HOOKTUBE.COM")) {
                                c7 = 18;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 301798888:
                            if (upperCase.equals("INVIDIOUS.MOOMOO.ME")) {
                                c7 = 19;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 360245068:
                            if (upperCase.equals("Y.COM.CM")) {
                                c7 = 20;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 405074072:
                            if (upperCase.equals("INVIDIOUS.EXONIP.DE")) {
                                c7 = 21;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 941554175:
                            if (upperCase.equals("WWW.YOUTUBE.COM")) {
                                c7 = 22;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1061977963:
                            if (upperCase.equals("TUBE.CONNECT.CAFE")) {
                                c7 = 23;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1229581114:
                            if (upperCase.equals("INVIDIO.US")) {
                                c7 = 24;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1607514856:
                            if (upperCase.equals("INVIDIOUS.FDN.FR")) {
                                c7 = 25;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1649009762:
                            if (upperCase.equals("INVIDIOUS.SNOPYTA.ORG")) {
                                c7 = 26;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1720784822:
                            if (upperCase.equals("REDIRECT.INVIDIOUS.IO")) {
                                c7 = 27;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1739373659:
                            if (upperCase.equals("YTPRIVATE.COM")) {
                                c7 = 28;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1818283559:
                            if (upperCase.equals("INVIDIOUS.048596.XYZ")) {
                                c7 = 29;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1876693401:
                            if (upperCase.equals("INVIDIOUS.BLAMEFRAN.NET")) {
                                c7 = 30;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 1999754024:
                            if (upperCase.equals("INVIDIOUS.SILKKY.CLOUD")) {
                                c7 = 31;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 2022964729:
                            if (upperCase.equals("WWW.YOUTUBE-NOCOOKIE.COM")) {
                                c7 = TokenParser.SP;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 2024273937:
                            if (upperCase.equals("WWW.INVIDIO.US")) {
                                c7 = '!';
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 2035582341:
                            if (upperCase.equals("INVIDIOUS.SITE")) {
                                c7 = TokenParser.DQUOTE;
                                break;
                            }
                            c7 = 65535;
                            break;
                        case 2075880438:
                            if (upperCase.equals("YOUTUBE.COM")) {
                                c7 = '#';
                                break;
                            }
                            c7 = 65535;
                            break;
                        default:
                            c7 = 65535;
                            break;
                    }
                    switch (c7) {
                        case 0:
                        case 1:
                        case 4:
                        case 5:
                        case 6:
                        case 7:
                        case '\b':
                        case '\t':
                        case '\n':
                        case 11:
                        case '\f':
                        case '\r':
                        case 15:
                        case 16:
                        case 18:
                        case 19:
                        case 20:
                        case 21:
                        case 23:
                        case 24:
                        case 25:
                        case 26:
                        case 27:
                        case 28:
                        case 29:
                        case 30:
                        case 31:
                        case '!':
                        case '\"':
                            if (path.equals("watch") && (queryValue = Utils.getQueryValue(stringToURL, "v")) != null) {
                                return assertIsId(queryValue);
                            }
                            String idFromSubpathsInPath = getIdFromSubpathsInPath(path);
                            if (idFromSubpathsInPath != null) {
                                return idFromSubpathsInPath;
                            }
                            String queryValue2 = Utils.getQueryValue(stringToURL, "v");
                            if (queryValue2 != null) {
                                return assertIsId(queryValue2);
                            }
                            return assertIsId(path);
                        case 2:
                        case 17:
                            String queryValue3 = Utils.getQueryValue(stringToURL, "v");
                            if (queryValue3 != null) {
                                return assertIsId(queryValue3);
                            }
                            return assertIsId(path);
                        case 3:
                        case 14:
                        case 22:
                        case '#':
                            if (path.equals("attribution_link")) {
                                try {
                                    return assertIsId(Utils.getQueryValue(Utils.stringToURL("https://www.youtube.com" + Utils.getQueryValue(stringToURL, "u")), "v"));
                                } catch (MalformedURLException unused2) {
                                    throw new ParsingException(r.n("Error: no suitable URL: ", str));
                                }
                            }
                            String idFromSubpathsInPath2 = getIdFromSubpathsInPath(path);
                            if (idFromSubpathsInPath2 != null) {
                                return idFromSubpathsInPath2;
                            }
                            return assertIsId(Utils.getQueryValue(stringToURL, "v"));
                        case ' ':
                            if (path.startsWith("embed/")) {
                                return assertIsId(path.substring(6));
                            }
                            break;
                    }
                    throw new ParsingException(r.n("Error: no suitable URL: ", str));
                }
                throw new ParsingException(r.n("Error: no suitable URL: ", str));
            }
            if (host.equalsIgnoreCase("googleads.g.doubleclick.net")) {
                throw new FoundAdException(r.n("Error: found ad: ", str));
            }
            throw new ParsingException("The URL is not a YouTube URL");
        } catch (MalformedURLException unused3) {
            throw new IllegalArgumentException("The given URL is not valid");
        }
    }

    @Override
    public String getUrl(String str) {
        return r.n("https://www.youtube.com/watch?v=", str);
    }

    @Override
    public boolean onAcceptUrl(String str) {
        try {
            getId(str);
            return true;
        } catch (FoundAdException e) {
            throw e;
        } catch (ParsingException unused) {
            return false;
        }
    }
}