Exemple #1
0
        protected IEnumerable <TorrentSearchResult> GetResultsFromSite(SearchUriBuilder searchUriBuilder, string query, int siteNumber, Func <Uri, string> downloadHtml)
        {
            Type searchResultType = typeof(TSearch);
            Uri  searchUri        = searchUriBuilder.GetUriWithParameters(query, siteNumber);

            string contents = downloadHtml(searchUri);

            // List of single items (item = raw search result (row) from the response)
            IEnumerable <string> rawResults = RegexParseHelper.GetMatchValues(contents, searchResultType.GetCustomAttribute <ItemPatternAttribute>().Pattern);

            foreach (string rawResult in rawResults)
            {
                TSearch searchResult = new TSearch();
                SetModelPropertiesValues(rawResult, searchResult);

                yield return(searchResult);
            }
        }
Exemple #2
0
 protected override IEnumerable <string> GetItemRawResults(string contents, string pattern)
 {
     return(RegexParseHelper.GetMatchValues(contents, pattern));
 }