Beispiel #1
0
        private void LookGenres(string url)
        {
            try
            {
                var html = Helpers.GetHtml(url);
                htmlNodes = html.CssSelect("div.column.genre-item > a");

                foreach (var item in htmlNodes)
                {
                    string shortcut = item.GetAttributeValue("href");
                    shortcut = shortcut.Substring(shortcut.LastIndexOf("/") + 1);
                    var name = item.CssSelect("span.genre-name-text").Single().InnerText.TrimStart().TrimEnd();

                    var genre = new Genre()
                    {
                        Name = name, ShortCut = shortcut
                    };
                    repo.Save(genre);

                    artists.SearchArtist("https://us.napster.com/genre/" + shortcut, genre.GenreId);
                }
            }
            catch (Exception ex) { }
        }