public override async Task <string> BypassAd(string adUrl)
        {
            string code = null;

            var requestHandler = HttpRequestHandler.NewWithCookies();

            using (var response = await new HttpClient().GetResponse(adUrl, requestHandler))
            {
                var respContent = await response.Content.ReadAsStringAsync();

                var text = "document.getElementById(\"btd\").href = revC(\"";
                var ix   = respContent.IndexOf(text) + text.Length;

                code = respContent.Substring(ix, respContent.IndexOf('"', ix) - ix);
                code = WebLogic.Decode(code);
            }

            requestHandler.AllowRedirects = false;
            requestHandler.Referrer       = adUrl;
            // This magic cookie has to be present...
            requestHandler.Cookies.Add(new System.Net.Cookie("s32", "1", "/", DomainName));

            using (var response = await new HttpClient().GetResponse($"https://{DomainName}/{code}", requestHandler))
            {
                if (response.Headers.Location != null)
                {
                    return(response.Headers.Location.ToString());
                }
            }

            return(null);
        }
Exemple #2
0
        public async Task <UrlExtractionResult> GetDirectDownloadUrl(string url)
        {
            var link = WebLogic.Decode(url);

            var requestHandler = HttpRequestHandler.NewWithCookies();

            requestHandler.Referrer = $"http://livedebrid.com/generate?link={link}";
            requestHandler.Method   = HttpMethod.Post;

            try
            {
                using (var response = await new Http.HttpClient().GetResponse($"http://livedebrid.com/download?link={link}", requestHandler))
                {
                    var http = await response.Content.ReadAsStringAsync();

                    var ix = http.IndexOf("http://adf.ly");

                    if (ix >= 0)
                    {
                        var downloadUrl = http.Substring(ix, http.IndexOf("'", ix) - ix);
                        return(await AdBypasser.AdBypasserService.BypassAd(downloadUrl));
                    }
                    else if (http.Contains("You only can download "))
                    {
                        return(ResponseTypes.LimitReached);
                    }
                    else
                    {
                        return(ResponseTypes.UnknownError);
                    }
                }
            }
            catch (Exception ex)
            {
                return(ex);
            }
        }