public static string GetCleanUrl(string ShortURL)
        {
            string cleanLink = string.Empty;

            WebData https = new WebData();

            https.AllowAutoRedirect = true;
            HttpResponse getResponese = https.GET(ShortURL);

            if (getResponese == null)
            {
                return(null);
            }

            string htmlBody = getResponese.Content;

            string[] htmlLines  = Regex.Split(htmlBody, "\n");
            string   targetLine = htmlLines.FirstOrDefault(x => x.Contains("canonical"));

            if (string.IsNullOrEmpty(targetLine) == false)
            {
                cleanLink = Regex.Match(targetLine, "http([^(]*).html").Groups[0].Value;
            }

            return(cleanLink);
        }
Пример #2
0
        public static string ShortUrl(string URL)
        {
            WebData https = new WebData();

            string ApiPage = "https://clck.ru/--?url=";

            HttpResponse getResponese = https.GET(ApiPage + URL);

            if (getResponese == null)
            {
                return(null);
            }

            return(getResponese.Content);
        }
Пример #3
0
        public static string ShortUrl(string URL)
        {
            WebData https = new WebData();

            string ApiPage = "https://is.gd/create.php?format=simple&url=";

            HttpResponse getResponese = https.GET(ApiPage + URL);

            if (getResponese == null)
            {
                return(null);
            }

            return(getResponese.Content);
        }