コード例 #1
0
        private static void GetLink_Megogo(string sLink)
        {
            string sData, sID = ""; Match m;

            HTTP.Referer = sLink;
            m            = Regex.Match(sLink, "/(\\d+)-");
            if (m.Success)
            {
                sID = m.Groups[1].Value;
            }
            else
            {
                Quit("No id in megogo link");
            }
            sLink = "http://megogo.net/b/info/?&i=" + sID + "&s=0&e=0&p=0&t=0&m=-1&l=ru&d=andr_iphone_ipad_winph&playerMode=html5&preview=0&h=" + sLink;
            sData = HTTP.GET(sLink);
            m     = Regex.Match(sData, "<src>(.*?)</");
            if (m.Success)
            {
                manifestUrl = m.Groups[1].Value.Replace("playlist.m3u8", "manifest.f4m");
                if (string.IsNullOrEmpty(manifestUrl))
                {
                    m = Regex.Match(sData, "<forbidden>(.*?)</");
                    if (m.Success)
                    {
                        Quit(m.Groups[1].Value);
                    }
                }
            }
        }
コード例 #2
0
        private static void GetLink_spbtv(string channelId)
        {
            HTTP.Referer = "http://spbtv.online/vplayer/last/GrindPlayer.swf";
            string data = HTTP.GET("http://tv3.spr.spbtv.com/v1/channels/" + channelId + "/stream?protocol=hds");
            Match  m    = Regex.Match(data, "\"url\":\"(.*?)\"");

            if (m.Success)
            {
                manifestUrl = Regex.Unescape(m.Groups[1].Value);
            }
        }
コード例 #3
0
ファイル: HDSDumper.cs プロジェクト: cimychen/hdsdump-gui
        public XmlNodeEx LoadXml(string manifestUrl)
        {
            string xmlText = "";

            if (string.IsNullOrEmpty(postData))
            {
                xmlText = HTTP.GET(manifestUrl);
            }
            else
            {
                xmlText = HTTP.POST(manifestUrl, postData);
            }

            if (Program.RegExMatch(@"<r>\s*?<to>(.*?)</to>", xmlText, out string sDomain))
            {
                if (Program.RegExMatch(@"^.*?://.*?/.*?/(.*)", manifestUrl, out manifestUrl))
                {
                    manifestUrl = sDomain + manifestUrl;
                    xmlText     = HTTP.GET(manifestUrl);
                }
            }

            xmlText = XmlValidate(xmlText);

            XmlDocumentEx xmldoc = new XmlDocumentEx();

            try {
                xmldoc.LoadXml(xmlText);
            } catch (Exception e) {
                if (Regex.IsMatch(xmlText, @"<html.*?<body", RegexOptions.Singleline))
                {
                    throw new XmlException("Error loading manifest. Url redirected to html page. Check the manifest url.", e);
                }
                else
                {
                    throw new XmlException("Error loading manifest. It's no valid xml file.", e);
                }
            }
            return((XmlNodeEx)xmldoc.DocumentElement);
        }
コード例 #4
0
        private static void GetLink_Rutube(string sLink)
        {
            string sData, sID = ""; Match m;

            m = Regex.Match(sLink, "/(\\d+)(/|$|\\?)");
            if (m.Success)
            {
                sID = m.Groups[1].Value;
            }
            else
            {
                Quit("No id in rutube link");
            }
            sLink        = "http://rutube.ru/play/embed/" + sID;
            HTTP.Referer = sLink;
            sData        = HTTP.GET("http://rutube.ru/api/play/options/" + sID + "/?format=json&sqr4374_compat=1&no_404=true&referer=" + Uri.EscapeDataString(sLink) + "&_=" + new Random());
            m            = Regex.Match(sData, "(http[^\">']+f4m[^\"}>']+)");
            if (m.Success)
            {
                manifestUrl = m.Groups[1].Value;
            }
        }
コード例 #5
0
        private static void Check4KnownLinks(string sLink)
        {
            Match m;

            if (RegExMatch(@"radio-canada.ca.*?[Mm]edia[-=](\d+)", sLink, out string id))
            {
                sLink = @"http://api.radio-canada.ca/validationMedia/v1/Validation.html?connectionType=broadband&output=json&multibitrate=true&deviceType=flashhd&appCode=medianet&idMedia=" + id + "&claims=null";
                string text = HTTP.GET(sLink);
                RegExMatch("\"url\":\"(.*?)\"", text, out manifestUrl);
            }
            else if (Regex.IsMatch(sLink, "(moon.hdkinoteatr.com|moonwalk.\\w+)/\\w+/\\w+/iframe"))
            {
                GetLink_Moonwalk(sLink);
            }
            else if (Regex.IsMatch(sLink, "/megogo.net/"))
            {
                GetLink_Megogo(sLink);
            }
            else if (Regex.IsMatch(sLink, "/rutube.ru/"))
            {
                GetLink_Rutube(sLink);
            }
            else if (Regex.IsMatch(sLink, "spbtv.com/v1/channels/(.*?)/"))
            {
                m = Regex.Match(sLink, "spbtv.com/v1/channels/(.*?)/");
                GetLink_spbtv(m.Groups[1].Value);
            }
            else if (Regex.IsMatch(sLink, "spbtv.online/channels/"))
            {
                string html = HTTP.GET(sLink);
                m = Regex.Match(html, "channelId\\s*:\\s*'(.*?)'");
                if (m.Success)
                {
                    GetLink_spbtv(m.Groups[1].Value);
                }
            }
        }
コード例 #6
0
        private static void GetLink_Moonwalk(string sLink)
        {
            string sHtml, sData, sPost; Match m;

            HTTP.Referer = sLink;
            sLink        = sLink.Replace("moonwalk.co", "moonwalk.cc");
            sLink        = sLink.Replace("moonwalk.pw", "moonwalk.cc");
            sHtml        = HTTP.GET(sLink);
            if (Regex.IsMatch(sHtml, "<iframe[^>]+src=\"(http.*?)\"", RegexOptions.Singleline))
            {
                sLink = sLink.Replace("moonwalk.co", "moonwalk.cc");
                sLink = sLink.Replace("moonwalk.pw", "moonwalk.cc");
                sHtml = HTTP.GET(sLink);
            }
            m = Regex.Match(sHtml, "\"csrf-token\"\\s+content=\"(.*?)\"");
            if (m.Success)
            {
                HTTP.Headers.Set("X-CSRF-Token", m.Groups[1].Value);
            }
            foreach (Match match in Regex.Matches(sHtml, "Set-Cookie:\\s*([^;]+)"))
            {
                HTTP.Cookies += " " + match.Groups[1].Value + ";";
            }
            string server = Regex.Match(sLink, "^(.*?//.*?)/").Groups[1].Value;

            HTTP.Headers.Set("Origin", server);
            HTTP.Headers.Set("X-Requested-With", "XMLHttpRequest");
            HTTP.Headers.Set("Pragma", "no-cache");
            m = Regex.Match(sHtml, "ajaxSetup\\([^)]+headers:(.*?)}", RegexOptions.Singleline);
            if (m.Success)
            {
                foreach (Match match in Regex.Matches(m.Groups[1].Value, "[\"']([\\w-_]+)[\"']\\s*?:\\s*?[\"'](\\w+)[\"']"))
                {
                    HTTP.Headers.Set(match.Groups[1].Value, match.Groups[2].Value);
                }
            }
            m = Regex.Match(sHtml, "window\\[[^]]+]\\s*=\\s*\\{(.*?)\\}", RegexOptions.Singleline);
            if (!m.Success)
            {
                Quit("Not found post parameters in moonwalk iframe");
            }
            sPost = m.Groups[1].Value.Replace("\n", "").Replace(" ", "").Replace("'", "");
            sPost = sPost.Replace(':', '=').Replace(',', '&').Replace(':', '=').Replace(':', '=').Replace("condition_detected?1=", "");
            foreach (Match match in Regex.Matches(sPost, ".=(\\w+)"))
            {
                m = Regex.Match(sHtml, "var\\s" + match.Groups[1].Value + "\\s*=\\s*['\"](.*?)['\"]");
                if (m.Success)
                {
                    sPost = sPost.Replace("=" + match.Groups[1].Value, "=" + m.Groups[1].Value);
                }
            }
            foreach (Match match in Regex.Matches(sHtml, "post_method\\.(\\w+)\\s*=\\s*(\\w+)"))
            {
                m = Regex.Match(sHtml, "var\\s" + match.Groups[1].Value + "\\s*=\\s*['\"](.*?)['\"]");
                if (m.Success)
                {
                    sPost += "&" + match.Groups[1].Value + "=" + m.Groups[1].Value;
                }
            }
            foreach (Match match in Regex.Matches(sHtml, "\\['(\\w+)'\\]\\s*=\\s*'(.*?)'"))
            {
                sPost += "&" + match.Groups[1].Value + "=" + match.Groups[2].Value;
            }
            foreach (Match match in Regex.Matches(sHtml, "window\\[[^\\]]+\\]\\[(.*?)\\]\\s*=\\s*(.*?);"))
            {
                string sVar = match.Groups[1].Value.Replace("+", "").Replace(" ", "").Replace("'", "");
                string sVal = match.Groups[2].Value.Replace("+", "").Replace(" ", "").Replace("'", "");
                sPost += "&" + sVar + "=" + sVal;
            }
            m = Regex.Match(sHtml, "'(/manifests/.*?)'");
            if (!m.Success)
            {
                Quit("Not found url for POST query in moonwalk iframe");
            }
            sData = HTTP.POST(server + m.Groups[1].Value, sPost);
            m     = Regex.Match(sData, "\"manifest_f4m\"\\s*?:\\s*?\"(.*?)\"");
            if (m.Success)
            {
                manifestUrl = Regex.Unescape(m.Groups[1].Value);
            }
        }