Fixed rule34, small refactor of the downloader classes

This commit is contained in:
Kwoth
2022-05-12 10:23:01 +02:00
parent b02768a08e
commit 1db97decd1
15 changed files with 69 additions and 41 deletions

View File

@@ -9,7 +9,7 @@ public sealed class DanbooruImageDownloader : DapiImageDownloader
private static readonly ConcurrentDictionary<string, bool> _existentTags = new();
private static readonly ConcurrentDictionary<string, bool> _nonexistentTags = new();
public DanbooruImageDownloader(HttpClient http)
public DanbooruImageDownloader(IHttpClientFactory http)
: base(Booru.Danbooru, http, "http://danbooru.donmai.us")
{
}
@@ -22,7 +22,8 @@ public sealed class DanbooruImageDownloader : DapiImageDownloader
if (_nonexistentTags.ContainsKey(tag))
return false;
var tags = await _http.GetFromJsonAsync<DapiTag[]>(
using var http = _http.CreateClient();
var tags = await http.GetFromJsonAsync<DapiTag[]>(
_baseUrl + "/tags.json" + $"?search[name_or_alias_matches]={tag}",
_serializerOptions,
cancel);