Esempio n. 1
0
        public IEnumerable <string> SearchForLoliSafeUrl(string searchableText, LoliSafeTypes loliSafeType)
        {
            Regex regex = GetLoliSafeUrlRegex();

            foreach (Match match in regex.Matches(searchableText))
            {
                string temp = match.Groups[0].ToString();
                string id   = match.Groups[2].Value;
                string url  = temp.Split('\"').First();

                yield return(CreateLoliSafeUrl(id, url, loliSafeType));
            }
        }
Esempio n. 2
0
        public string CreateLoliSafeUrl(string id, string detectedUrl, LoliSafeTypes type)
        {
            string url;

            switch (type)
            {
            case LoliSafeTypes.Mp4:
                url = @"https://loli.temel.me/" + id + ".mp4";
                break;

            case LoliSafeTypes.Webm:
                url = @"https://loli.temel.me/" + id + ".webm";
                break;

            case LoliSafeTypes.Any:
                url = detectedUrl;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(url);
        }