Dieses Snippet holt euch die Charts von N-Joy!
Aufruf:
String Chart_0 = Charts.GetCharts(0);
bzw.
List<String> charts = Charts.GetCharts();
class Charts
{
public static List<String> GetCharts()
{
WebClient wc = new WebClient();
String qt = wc.DownloadString("http://www.n-joy.de/pages_special/0,3046,SPM11218,00.html");
List<String> charts = new List<String>();
MatchCollection mc = Regex.Matches(qt,
"<td class=\"allAvailableSpace\" headers=\"text\"><strong>(.+)<\\/strong><br \\/>(.+)<br \\/>");
foreach (Match m in mc)
{
charts.Add(Regex.Split(m.Value, "<br \\/>")[1] + " - "
+ m.Groups[1].Value);
}
return charts;
}
public static string GetCharts(int pos)
{
if (pos < 0 || pos > 39) { throw new Exception("Illegal position"); }
WebClient wc = new WebClient();
String qt = wc.DownloadString("http://www.n-joy.de/pages_special/0,3046,SPM11218,00.html");
MatchCollection mc = Regex.Matches(qt,
"<td class=\"allAvailableSpace\" headers=\"text\"><strong>(.+)<\\/strong><br \\/>(.+)<br \\/>");
return Regex.Split(mc[pos].Value, "<br \\/>")[1] + " - " + mc[pos].Groups[1].Value;
}
}
5 Kommentare zum Snippet