mirror of
https://github.com/C9Glax/tranga.git
synced 2025-04-12 19:36:08 +02:00
This commit is contained in:
parent
15ced9aed8
commit
99a3f2614d
@ -1,14 +1,16 @@
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using API.Schema;
|
using log4net;
|
||||||
|
|
||||||
namespace API.MangaDownloadClients;
|
namespace API.MangaDownloadClients;
|
||||||
|
|
||||||
internal abstract class DownloadClient
|
internal abstract class DownloadClient
|
||||||
{
|
{
|
||||||
private readonly Dictionary<RequestType, DateTime> _lastExecutedRateLimit;
|
private readonly Dictionary<RequestType, DateTime> _lastExecutedRateLimit;
|
||||||
|
protected ILog Log { get; init; }
|
||||||
|
|
||||||
protected DownloadClient()
|
protected DownloadClient()
|
||||||
{
|
{
|
||||||
|
this.Log = LogManager.GetLogger(GetType());
|
||||||
this._lastExecutedRateLimit = new();
|
this._lastExecutedRateLimit = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,17 @@ internal class HttpDownloadClient : DownloadClient
|
|||||||
{
|
{
|
||||||
return new RequestResult(response.StatusCode, null, Stream.Null);
|
return new RequestResult(response.StatusCode, null, Stream.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream stream = response.Content.ReadAsStream();
|
Stream stream;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
stream = response.Content.ReadAsStream();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error(e);
|
||||||
|
return new RequestResult(HttpStatusCode.InternalServerError, null, Stream.Null);
|
||||||
|
}
|
||||||
|
|
||||||
HtmlDocument? document = null;
|
HtmlDocument? document = null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user