public TorznabCapabilities GetCapabilities(TorznabSettings indexerSettings)
        {
            var key          = indexerSettings.ToJson();
            var capabilities = _capabilitiesCache.Get(key, () => FetchCapabilities(indexerSettings), TimeSpan.FromDays(7));

            return(capabilities);
        }
        private TorznabCapabilities FetchCapabilities(TorznabSettings indexerSettings)
        {
            var capabilities = new TorznabCapabilities();

            var url = string.Format("{0}/api?t=caps", indexerSettings.Url.TrimEnd('/'));

            if (indexerSettings.ApiKey.IsNotNullOrWhiteSpace())
            {
                url += "&apikey=" + indexerSettings.ApiKey;
            }

            var request = new HttpRequest(url, HttpAccept.Rss);

            try
            {
                var response = _httpClient.Get(request);

                capabilities = ParseCapabilities(response);
            }
            catch (Exception ex)
            {
                _logger.DebugException(string.Format("Failed to get capabilities from {0}: {1}", indexerSettings.Url, ex.Message), ex);
            }

            return(capabilities);
        }
Example #3
0
 public TorznabRssParser(TorznabSettings settings)
 {
     UseEnclosureUrl = true;
     _settings       = settings;
 }