mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Fixed rule34, small refactor of the downloader classes
This commit is contained in:
@@ -5,7 +5,7 @@ namespace NadekoBot.Modules.Nsfw.Common;
|
||||
|
||||
public class Rule34ImageDownloader : ImageDownloader<Rule34Object>
|
||||
{
|
||||
public Rule34ImageDownloader(HttpClient http)
|
||||
public Rule34ImageDownloader(IHttpClientFactory http)
|
||||
: base(Booru.Rule34, http)
|
||||
{
|
||||
}
|
||||
@@ -17,9 +17,21 @@ public class Rule34ImageDownloader : ImageDownloader<Rule34Object>
|
||||
CancellationToken cancel = default)
|
||||
{
|
||||
var tagString = ImageDownloaderHelper.GetTagString(tags);
|
||||
var uri = "https://rule34.xxx/index.php?page=dapi&s=post&q=index&json=1&limit=100"
|
||||
+ $"&tags={tagString}&pid={page}";
|
||||
var images = await _http.GetFromJsonAsync<List<Rule34Object>>(uri, _serializerOptions, cancel);
|
||||
var uri = $"https://api.rule34.xxx//index.php?page=dapi&s=post"
|
||||
+ $"&q=index"
|
||||
+ $"&json=1"
|
||||
+ $"&limit=100"
|
||||
+ $"&tags={tagString}"
|
||||
+ $"&pid={page}";
|
||||
|
||||
using var http = _http.CreateClient();
|
||||
http.DefaultRequestHeaders
|
||||
.TryAddWithoutValidation("cookie", "cf_clearance=Gg3bVffg9fOL_.9fIdKmu5PJS86eTI.yTrhbR8z2tPc-1652310659-0-250");
|
||||
|
||||
http.DefaultRequestHeaders
|
||||
.TryAddWithoutValidation("user-agent",
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36");
|
||||
var images = await http.GetFromJsonAsync<List<Rule34Object>>(uri, _serializerOptions, cancel);
|
||||
|
||||
if (images is null)
|
||||
return new();
|
||||
|
Reference in New Issue
Block a user