diff --git a/SCrawler.PluginProvider/ObjectInterfaces/ILogProvider.vb b/SCrawler.PluginProvider/ObjectInterfaces/ILogProvider.vb index e95236d..3879484 100644 --- a/SCrawler.PluginProvider/ObjectInterfaces/ILogProvider.vb +++ b/SCrawler.PluginProvider/ObjectInterfaces/ILogProvider.vb @@ -11,6 +11,6 @@ Namespace Plugin Overloads Sub Add(ByVal Message As String) Overloads Sub Add(ByVal ex As Exception, ByVal Message As String, Optional ByVal ShowMainMsg As Boolean = False, Optional ByVal ShowErrorMsg As Boolean = False, - Optional ByVal SendInLog As Boolean = True) + Optional ByVal SendToLog As Boolean = True) End Interface End Namespace \ No newline at end of file diff --git a/SCrawler/API/Mastodon/SiteSettings.vb b/SCrawler/API/Mastodon/SiteSettings.vb index 9026c92..99606d9 100644 --- a/SCrawler/API/Mastodon/SiteSettings.vb +++ b/SCrawler/API/Mastodon/SiteSettings.vb @@ -203,17 +203,21 @@ Namespace API.Mastodon #Region "UpdateServersList" Private Sub UpdateServersList() Try - Dim r$ = GetWebString("https://api.joinmastodon.org/servers?language=&category=®ion=&ownership=®istrations=",, EDP.ThrowException) - If Not r.IsEmptyString Then - Dim j As EContainer = JsonDocument.Parse(r, EDP.ReturnValue) - If If(j?.Count, 0) > 0 Then - Domains.Domains.ListAddList(j.Select(Function(e) e.Value("domain")), LAP.NotContainsOnly, EDP.ReturnValue) - Domains.Domains.Sort() - Domains.Save() - j.Dispose() + Using resp As New Responser With { + .ProcessExceptionDecision = Function(rr, obj, e) If(rr.StatusCode = Net.HttpStatusCode.ServiceUnavailable, + EDP.ReturnValue, EDP.ThrowException)} + Dim r$ = resp.GetResponse("https://api.joinmastodon.org/servers?language=&category=®ion=&ownership=®istrations=") + If Not r.IsEmptyString Then + Dim j As EContainer = JsonDocument.Parse(r, EDP.ReturnValue) + If If(j?.Count, 0) > 0 Then + Domains.Domains.ListAddList(j.Select(Function(e) e.Value("domain")), LAP.NotContainsOnly, EDP.ReturnValue) + Domains.Domains.Sort() + Domains.Save() + j.Dispose() + End If + DomainsLastUpdateDate.Value = Now End If - End If - DomainsLastUpdateDate.Value = Now + End Using Catch ex As Exception ErrorsDescriber.Execute(EDP.SendToLog, ex, "[API.Mastodon.SiteSettings.UpdateServersList]") End Try diff --git a/SCrawler/API/PornHub/UserData.vb b/SCrawler/API/PornHub/UserData.vb index 7605e7b..d9a8606 100644 --- a/SCrawler/API/PornHub/UserData.vb +++ b/SCrawler/API/PornHub/UserData.vb @@ -896,8 +896,8 @@ Namespace API.PornHub If Not script.IsEmptyString Then Using j As EContainer = JsonDocument.Parse(script) If j.ListExists Then - Dim s As List(Of Sizes) = j.Select(Function(jj) New Sizes(jj.Value("quality"), jj.Value("videoUrl"))).ToList - If s.ListExists Then s.Sort() : result = s(0).Data + Dim s As List(Of Sizes) = j.Select(Function(jj) New Sizes(jj.Value("quality"), jj.Value("videoUrl"))).ListWithRemove(Function(d) d.HasError Or d.Data.IsEmptyString) + If s.ListExists Then s.Sort() : result = s(0).Data : s.Clear() End If End Using End If diff --git a/SCrawler/API/Redgifs/UserData.vb b/SCrawler/API/Redgifs/UserData.vb index 54a312f..f68528c 100644 --- a/SCrawler/API/Redgifs/UserData.vb +++ b/SCrawler/API/Redgifs/UserData.vb @@ -249,7 +249,7 @@ Namespace API.RedGifs Optional ByVal EObj As Object = Nothing) As Integer Dim s As WebExceptionStatus = Responser.Status Dim sc As HttpStatusCode = Responser.StatusCode - If sc = HttpStatusCode.NotFound Or s = DataGone Then + If sc = HttpStatusCode.NotFound Or s = DataGone Or sc = DataGone Then UserExists = False ElseIf sc = HttpStatusCode.Unauthorized Then MyMainLOG = $"RedGifs credentials have expired [{CInt(sc)}]: {ToStringForLog()}" diff --git a/SCrawler/PluginsEnvironment/Hosts/LogHost.vb b/SCrawler/PluginsEnvironment/Hosts/LogHost.vb index b32fd65..72b7de3 100644 --- a/SCrawler/PluginsEnvironment/Hosts/LogHost.vb +++ b/SCrawler/PluginsEnvironment/Hosts/LogHost.vb @@ -13,8 +13,8 @@ Namespace Plugin.Hosts End Sub Friend Sub Add(ByVal ex As Exception, ByVal Message As String, Optional ByVal ShowMainMsg As Boolean = False, Optional ByVal ShowErrorMsg As Boolean = False, - Optional ByVal SendInLog As Boolean = True) Implements ILogProvider.Add - ErrorsDescriber.Execute(New ErrorsDescriber(ShowMainMsg, ShowErrorMsg, SendInLog), ex, Message) + Optional ByVal SendToLog As Boolean = True) Implements ILogProvider.Add + ErrorsDescriber.Execute(New ErrorsDescriber(ShowMainMsg, ShowErrorMsg, SendToLog), ex, Message) End Sub End Class End Namespace \ No newline at end of file