コード例 #1
0
        public async Task GetRemoteEpisodes(long showId, int season)
        {
            List <RemoteEpisode> episodes = new List <RemoteEpisode>();

            string str = await _remote.GetRemoteEpisodes(showId, season).ConfigureAwait(false);

            var doc = new HtmlDocument();

            doc.LoadHtml(str);

            var nodes = doc.DocumentNode.SelectNodes("//select")
                        .Where(select => select.Attributes["name"].Value == "qsiEp")
                        .SelectMany(y => y.Descendants("option"))
                        .ToList();


            foreach (HtmlNode htmlNode in nodes)
            {
                var key = htmlNode.GetAttributeValue("value", "");

                if (key.StartsWith(showId.ToString()))
                {
                    episodes.Add(new RemoteEpisode(key, showId, season));
                }
            }

            _cache.Save(episodes);
        }