예제 #1
0
        private static PodKast CreatePodkastItem(string urlExpressionString, string videokastsSectionAsString)
        {
            Regex           queryVideokasts = new Regex(urlExpressionString, RegexOptions.Singleline);
            MatchCollection matches         = queryVideokasts.Matches(videokastsSectionAsString);

            if (matches.Count == 1)
            {
                PodKast item = new PodKast(matches[0].Groups["url"].Value, matches[0].Groups["title"].Value);
                item.Description = matches[0].Groups["description"].Value;
                item.Bilde       = String.Empty;
                return(item);
            }
            return(null);
        }
예제 #2
0
        private static IList <PodKast> CreatePodkasts(string videokastsSectionAsString)
        {
            string          tbodyExpression = "<tbody>(.*?)</tbody>";
            Regex           queryTbodys     = new Regex(tbodyExpression, RegexOptions.Singleline);
            MatchCollection matches         = queryTbodys.Matches(videokastsSectionAsString);
            IList <PodKast> items           = new List <PodKast>();

            foreach (Match x in matches)
            {
                string urlExpressionString =
                    "<tbody>.*?<tr class=\"pod-row\">.*?<th>(?<title>[^</]*)</th>.*?<td class=\"pod-rss\">.*?</td>.*?</tr>.*?<tr class=\"pod-desc\">.*?<td colspan=\"3\">.*?<p>(?<description>[^<]*)<a href=\".*?\" title=\".*?\">.*?</a></p>.*?</td>.*?</tr>.*?<tr class=\"pod-rss-url\">.*?<td colspan=\"3\">.*?<a href=\"(?<url>[^\"]*)\" title=\".*?\">.*?</a>.*?</td>.*?</tr>.*?</tbody>";
                PodKast kast = CreatePodkastItem(urlExpressionString, x.Groups[0].Value);
                if (kast != null)
                {
                    items.Add(kast);
                }
            }
            return(items);
        }