diff --git a/source/Playnite/GoogleImageDownloader.cs b/source/Playnite/GoogleImageDownloader.cs index 33b43430a..a6d43cb00 100644 --- a/source/Playnite/GoogleImageDownloader.cs +++ b/source/Playnite/GoogleImageDownloader.cs @@ -34,6 +34,8 @@ public class GoogleImage public class GoogleImageDownloader : IDisposable { + private static ILogger logger = LogManager.GetLogger(); + private readonly OffscreenWebView webView; public GoogleImageDownloader() { @@ -89,8 +91,8 @@ public async Task> GetImages(string searchTerm, SafeSearchSett } else { - googleContent = Regex.Replace(googleContent, @"\r\n?|\n", string.Empty); - var matches = Regex.Matches(googleContent, @"\[""(https:\/\/encrypted-[^,]+?)"",\d+,\d+\],\[""(http.+?)"",(\d+),(\d+)\]"); + var formatted = Regex.Replace(googleContent, @"\r\n?|\n", string.Empty); + var matches = Regex.Matches(formatted, @"\[""(https:\/\/encrypted-[^,]+?)"",\d+,\d+\],\[""(http.+?)"",(\d+),(\d+)\]"); foreach (Match match in matches) { var data = Serialization.FromJson>>($"[{match.Value}]"); @@ -104,6 +106,12 @@ public async Task> GetImages(string searchTerm, SafeSearchSett } } + if (!images.HasItems()) + { + logger.Error("Failed to parse any Google image results."); + logger.Debug(googleContent); + } + return images; } }