示例#1
0
        public static String extractDownloadUri(string episodeUri)
        {
            Console.WriteLine("Extracting Download URL for {0}", episodeUri);
            WebClient wc   = new WebClient();
            string    Data = wc.DownloadString(episodeUri);

            buffer3 = new mshtml.HTMLDocument();
            wc.Dispose();
            buffer3.designMode = "off";
            buffer4            = (mshtml.IHTMLDocument2)buffer3;
            buffer4.write(Data); // beware the hang.
            Expressions.vidStreamRegex = new Regex(Expressions.videoIDRegex);
            IHTMLElementCollection col = buffer3.getElementsByTagName("IFRAME");
            Match  match;
            string id = null;

            foreach (IHTMLElement elem in col)
            {
                match = Expressions.vidStreamRegex.Match(elem.getAttribute("src"));
                if (match.Success)
                {
                    id = match.Groups[0].Value;
                    break;
                }
                else
                {
                    return(null);
                }
            }
            col = null;
            buffer3.clear();
            buffer4.clear();

            Task <String> response = Storage.client.GetStringAsync($"https://vidstreaming.io/ajax.php?id={id}");

            Expressions.vidStreamRegex = new Regex(Expressions.downloadLinkRegex);
            match = Expressions.vidStreamRegex.Match(response.Result);
            if (match.Success)
            {
                string ursTruly = match.Groups[0].Value.Replace("\\", string.Empty);
                int    ids      = Extensions.indexOfEquals(ursTruly) + 1;
                if (ursTruly.Contains("goto.php"))
                {
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ursTruly);
                    request.AutomaticDecompression = DecompressionMethods.GZip;
                    WebResponse res = request.GetResponse();
                    string      s   = res.ResponseUri.ToString();
                    return(s);
                }
                else
                {
                    return(ursTruly);
                }
            }
            return(null);
        }