using System.Collections.Generic;
public static void Main()
var gigs = new Dictionary<(string artist, DateTime date, string city), List<string>>();
var endDate = new DateTime(2022, 12, 05);
Console.WriteLine($"{i}. Date:{(gigs.Any() ? gigs.Max(x => x.Key.date) : DateTime.Today)} Count:{gigs.Count}");
var wb = new WebClient();
var url = @"https://www.koncertomania.pl/koncerty";
var page = wb.DownloadString(url);
if (!BrowseGigs(gigs, page, endDate))
Console.Write($"{gig.Key.artist} / {gig.Key.date.ToShortDateString()} / {gig.Key.city}");
Console.Write($" [{string.Join(", ", gig.Value)}]");
Console.WriteLine("Koniec");
private static bool BrowseGigs(Dictionary<(string artist, DateTime date, string city), List<string>> gigs, string page, DateTime maxDate)
using (var reader = new StringReader(page))
var doc = new HtmlAgilityPack.HtmlDocument();
var resultList = doc.DocumentNode.SelectSingleNode("//div [@id='result-list']");
foreach (var node in resultList.SelectNodes("div [@class='vevent res-item']/div [@class='desc-cnt']|div [@class='vevent res-item odd']/div [@class='desc-cnt']"))
var summary = node.SelectSingleNode("abbr [@class='summary']");
var dateNode = node.SelectSingleNode("p [@class='start date concert-when']/span [@class='dtstart']");
var date = DateTime.Parse(dateNode.InnerText, new System.Globalization.CultureInfo("pl-PL"));
var city = node.SelectSingleNode("abbr [@class='location']/abbr [@class='locality']/p [@class='concert-where']/a").InnerText;
var artistList = summary.SelectNodes("p [@class='concert-who']/a").Select(x => x.InnerText).ToList();
foreach (var artist in artistList)
if (!gigs.ContainsKey((artist, date, city)))
gigs[(artist, date, city)] = artistList;