示例#1
0
        public IEnumerable <SerieLink> AllSeries()
        {
            OmgTorrentCrawler crawler = new OmgTorrentCrawler();
            var series = crawler.CollectSeriesUrls();

            return(series);
        }
示例#2
0
        /// <summary>
        /// Search torrents related to a serie containing <paramref name="term"/>
        /// </summary>
        /// <param name="term">a term in the serie title</param>
        /// <returns></returns>
        public IEnumerable <TorrentLink> Search(string term)
        {
            string            searchTerm = term.ToLowerInvariant();
            OmgTorrentCrawler crawler    = new OmgTorrentCrawler();
            var series = crawler.CollectSeriesUrls()
                         .Where(s => s.Title.Contains(searchTerm));

            List <TorrentLink> torrents = new List <TorrentLink>();

            foreach (SerieLink s in series)
            {
                var task = crawler.CollectSerieTorrents(s.Url);
                task.ConfigureAwait(false);
                var results = task.Result;
                if (results != null)
                {
                    torrents.AddRange(results);
                }
            }
            return(torrents);
        }