Skip to content

Commit

Permalink
Finished working on fetching new releases
Browse files Browse the repository at this point in the history
  • Loading branch information
dm3ch committed Jun 6, 2022
1 parent 84fcfa7 commit cef74bd
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/NzbDrone.Core/Indexers/Definitions/Lostfilm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override IIndexerRequestGenerator GetRequestGenerator()

public override IParseIndexerResponse GetParser()
{
return new LostfilmParser(Settings, Capabilities.Categories) { HttpClient = _httpClient, Logger = _logger, Definition = Definition };
return new LostfilmParser(Settings, Capabilities.Categories) { HttpClient = _httpClient, Logger = _logger, Definition = Definition, Indexer = this };
}

protected override async Task DoLogin()
Expand Down Expand Up @@ -184,19 +184,6 @@ private IEnumerable<IndexerRequest> GetPagedRequests(string term, int[] categori
throw new Exception("Lostfilm search not implemented");
}

// else
// {
// var queryCollection = new NameValueCollection
// {
// // Remove season and episode info from search term cause it breaks search
// { "keywords", Regex.Replace(term, @"(?:[SsEe]?\d{1,4}){1,2}$", "").TrimEnd() },
// { "limit", "20" },
// { "orderby_sort", "entry_date|desc" }
// };

// requestUrl = string.Format("{0}/ajax/search_result/P0?{1}", Settings.BaseUrl.TrimEnd('/'), queryCollection.GetQueryString());
// }
// TODO: Implement searching
var request = new IndexerRequest(requestUrl, HttpAccept.Html);
yield return request;
}
Expand Down Expand Up @@ -252,6 +239,7 @@ public class LostfilmParser : IParseIndexerResponse
private static readonly Regex ParseReleaseDetailsRegex = new Regex("Видео:\\ (?<quality>.+).\\ Размер:\\ (?<size>.+).\\ Перевод", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public IIndexerHttpClient HttpClient { get; set; }
public ProviderDefinition Definition { get; set; }
public Lostfilm Indexer { get; set; }
public Logger Logger { get; set; }

public LostfilmParser(UserPassCaptchaTorrentBaseSettings settings, IndexerCapabilitiesCategories categories)
Expand Down Expand Up @@ -404,7 +392,13 @@ private IList<TorrentInfo> FetchTrackerReleases(TrackerUrlDetails details)
var url = _settings.BaseUrl + "v_search.php" + "?" + queryCollection.GetQueryString();

// Get redirection page with generated link on it. This link can't be constructed manually as it contains Hash field and hashing algo is unknown.
var req = new IndexerRequest(url, HttpAccept.Html);
var requestBuilder = new HttpRequestBuilder(url)
{
AllowAutoRedirect = true,
};
requestBuilder.PostProcess += r => r.RequestTimeout = TimeSpan.FromSeconds(15);
requestBuilder.SetCookies(Indexer.Cookies);
var req = new IndexerRequest(requestBuilder.Build());
var results = new IndexerResponse(req, HttpClient.ExecuteProxied(req.HttpRequest, Definition));

if (results.Content == null)
Expand Down

0 comments on commit cef74bd

Please sign in to comment.