public IEnumerable <string> SearchForCatBoxUrl(string searchableText, CatBoxTypes catBoxType) { Regex regex = GetCatBoxUrlRegex(); 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(CreateCatBoxUrl(id, url, catBoxType)); } }
public string CreateCatBoxUrl(string id, string detectedUrl, CatBoxTypes type) { string url; switch (type) { case CatBoxTypes.Mp4: url = @"https://files.catbox.moe/" + id + ".mp4"; break; case CatBoxTypes.Webm: url = @"https://files.catbox.moe/" + id + ".webm"; break; case CatBoxTypes.Any: url = detectedUrl; break; default: throw new ArgumentOutOfRangeException(); } return(url); }