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)); } }
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); }