|
|
|
@ -8,20 +8,11 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
|
|
|
|
{
|
|
|
|
|
public NyaaSettings Settings { get; set; }
|
|
|
|
|
|
|
|
|
|
public int MaxPages { get; set; }
|
|
|
|
|
public int PageSize { get; set; }
|
|
|
|
|
|
|
|
|
|
public NyaaRequestGenerator()
|
|
|
|
|
{
|
|
|
|
|
MaxPages = 30;
|
|
|
|
|
PageSize = 100;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual IndexerPageableRequestChain GetRecentRequests()
|
|
|
|
|
{
|
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
|
|
|
|
|
|
pageableRequests.Add(GetPagedRequests(MaxPages, null));
|
|
|
|
|
pageableRequests.Add(GetPagedRequests(null));
|
|
|
|
|
|
|
|
|
|
return pageableRequests;
|
|
|
|
|
}
|
|
|
|
@ -36,28 +27,16 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
|
|
|
|
throw new System.NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, string term)
|
|
|
|
|
private IEnumerable<IndexerRequest> GetPagedRequests(string term)
|
|
|
|
|
{
|
|
|
|
|
var baseUrl = string.Format("{0}/?page=rss{1}", Settings.BaseUrl.TrimEnd('/'), Settings.AdditionalParameters);
|
|
|
|
|
var baseUrl = $"{Settings.BaseUrl.TrimEnd('/')}/?page=rss{Settings.AdditionalParameters}";
|
|
|
|
|
|
|
|
|
|
if (term != null)
|
|
|
|
|
{
|
|
|
|
|
baseUrl += "&term=" + term;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PageSize == 0)
|
|
|
|
|
{
|
|
|
|
|
yield return new IndexerRequest(baseUrl, HttpAccept.Rss);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
yield return new IndexerRequest(baseUrl, HttpAccept.Rss);
|
|
|
|
|
|
|
|
|
|
for (var page = 1; page < maxPages; page++)
|
|
|
|
|
{
|
|
|
|
|
yield return new IndexerRequest($"{baseUrl}&offset={page + 1}", HttpAccept.Rss);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yield return new IndexerRequest(baseUrl, HttpAccept.Rss);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string PrepareQuery(string query)
|
|
|
|
|