コード例 #1
0
ファイル: HttpIndexerBase.cs プロジェクト: sirimore/Readarr
        protected virtual IList <ReleaseInfo> FetchPage(IndexerRequest request, IParseIndexerResponse parser)
        {
            var response = FetchIndexerResponse(request);

            try
            {
                return(parser.ParseResponse(response).ToList());
            }
            catch (Exception ex)
            {
                ex.WithData(response.HttpResponse, 128 * 1024);
                _logger.Trace("Unexpected Response content ({0} bytes): {1}", response.HttpResponse.ResponseData.Length, response.HttpResponse.Content);
                throw;
            }
        }
コード例 #2
0
ファイル: HttpIndexerBase.cs プロジェクト: jayd2446/Sonarr
        protected virtual IList <ReleaseInfo> FetchPage(IndexerRequest request, IParseIndexerResponse parser)
        {
            var url = request.Url;

            _logger.Debug("Downloading Feed " + request.Url);
            var response = new IndexerResponse(request, _httpClient.Execute(request.HttpRequest));

            if (response.HttpResponse.Headers.ContentType != null && response.HttpResponse.Headers.ContentType.Contains("text/html") &&
                request.HttpRequest.Headers.Accept != null && !request.HttpRequest.Headers.Accept.Contains("text/html"))
            {
                throw new WebException("Indexer responded with html content. Site is likely blocked or unavailable.");
            }

            return(parser.ParseResponse(response).ToList());
        }
コード例 #3
0
        private TorrentInfo[] ParseResponse(IParseIndexerResponse parser, IndexerResponse response)
        {
            try
            {
                var releases = parser.ParseResponse(response).Cast<TorrentInfo>().ToArray();
                return releases;

            }
            catch (Exception ex)
            {
                _logger.Debug(ex, "Unable to parse indexer feed: " + ex.Message);
                throw new UnsupportedFeedException("Unable to parse indexer: " + ex.Message);
            }
        }
コード例 #4
0
ファイル: HttpIndexerBase.cs プロジェクト: ismell/Sonarr
        protected virtual IList <ReleaseInfo> FetchPage(IndexerRequest request, IParseIndexerResponse parser)
        {
            var response = FetchIndexerResponse(request);

            return(parser.ParseResponse(response).ToList());
        }