diff --git a/ExportViewer.Core/Services/DataParsingService.cs b/ExportViewer.Core/Services/DataParsingService.cs index 3c2e853..3b9db37 100644 --- a/ExportViewer.Core/Services/DataParsingService.cs +++ b/ExportViewer.Core/Services/DataParsingService.cs @@ -71,7 +71,7 @@ public Task> GetExportFiles (string exportLocation , ExportT Console.WriteLine($"Directory {subDirectoryLocation} does not exist."); } } - foreach (var subDirectory in new[] { "archived_threads/" , "filtered_threads/" , "inbox/" }) + foreach (var subDirectory in new[] { "archived_threads/" , "filtered_threads/" , "inbox/", "e2ee_cutover/" }) { var subDirectoryLocation = Path.Combine(exportLocation , "your_activity_across_facebook" , "messages" , subDirectory); var fileExtension = fileExtensions[type]; diff --git a/ExportViewer.Core/Services/HtmlParsingService.cs b/ExportViewer.Core/Services/HtmlParsingService.cs index 32df8bf..f9fae99 100644 --- a/ExportViewer.Core/Services/HtmlParsingService.cs +++ b/ExportViewer.Core/Services/HtmlParsingService.cs @@ -104,39 +104,71 @@ public async Task> GetMessages (string filePath , CultureIn Parallel.ForEach(divs , node => { - var divImage = node.QuerySelector("img._a6_o._3-96"); - var divVideo = node.QuerySelector("video._a6_o._3-96"); + var divImages = node.QuerySelectorAll("img._a6_o._3-96"); + var divVideos = node.QuerySelectorAll("video._a6_o._3-96"); var divDate = node.QuerySelector("div._3-94._a6-o")?.QuerySelector("div._a72d"); - if (((divImage != null && divDate != null) || (divVideo != null && divDate != null)) && !string.IsNullOrEmpty(divDate.TextContent)) + if (((divImages != null && divDate != null) || (divVideos != null && divDate != null)) && !string.IsNullOrEmpty(divDate.TextContent)) { - string href = divImage != null ? divImage.GetAttribute("src") : divVideo.GetAttribute("src"); - if ((!href.StartsWith("http") || !href.StartsWith("https")) && (href.EndsWith(".jpg") || href.EndsWith(".png") || href.EndsWith(".gif") || href.EndsWith(".mp4"))) + Parallel.ForEach(divImages , divImage => { - if (Thread.CurrentThread.CurrentCulture.IsReadOnly || locale.IsReadOnly) - { - var clone = Thread.CurrentThread.CurrentCulture.Clone() as CultureInfo; - clone.DateTimeFormat.PMDesignator = "po południu"; - clone.DateTimeFormat.AMDesignator = "rano"; - Thread.CurrentThread.CurrentCulture = clone; - Thread.CurrentThread.CurrentUICulture = clone; - locale = clone; - } - else + string href = divImage.GetAttribute("src"); + if ((!href.StartsWith("http") || !href.StartsWith("https")) && (href.EndsWith(".jpg") || href.EndsWith(".png") || href.EndsWith(".gif"))) { - locale.DateTimeFormat.PMDesignator = "po południu"; - locale.DateTimeFormat.AMDesignator = "rano"; + if (Thread.CurrentThread.CurrentCulture.IsReadOnly || locale.IsReadOnly) + { + var clone = Thread.CurrentThread.CurrentCulture.Clone() as CultureInfo; + clone.DateTimeFormat.PMDesignator = "po południu"; + clone.DateTimeFormat.AMDesignator = "rano"; + Thread.CurrentThread.CurrentCulture = clone; + Thread.CurrentThread.CurrentUICulture = clone; + locale = clone; + } + else + { + locale.DateTimeFormat.PMDesignator = "po południu"; + locale.DateTimeFormat.AMDesignator = "rano"; + } + + + DateTime parsedDate = DateTime.ParseExact(divDate.TextContent , "MMM dd, yyyy h:mm:sstt" , locale); + + if (File.Exists(exportLocation + href)) + { + messages.Add(new Message { Link = href , Date = parsedDate }); + } } + }); - - - DateTime parsedDate = DateTime.ParseExact(divDate.TextContent , "MMM dd, yyyy h:mm:sstt" , locale); - - if (File.Exists(exportLocation + href)) + Parallel.ForEach(divVideos , divVideo => + { + string href = divVideo.GetAttribute("src"); + if ((!href.StartsWith("http") || !href.StartsWith("https")) && href.EndsWith(".mp4")) { - messages.Add(new Message { Link = href , Date = parsedDate }); + if (Thread.CurrentThread.CurrentCulture.IsReadOnly || locale.IsReadOnly) + { + var clone = Thread.CurrentThread.CurrentCulture.Clone() as CultureInfo; + clone.DateTimeFormat.PMDesignator = "po południu"; + clone.DateTimeFormat.AMDesignator = "rano"; + Thread.CurrentThread.CurrentCulture = clone; + Thread.CurrentThread.CurrentUICulture = clone; + locale = clone; + } + else + { + locale.DateTimeFormat.PMDesignator = "po południu"; + locale.DateTimeFormat.AMDesignator = "rano"; + } + + + DateTime parsedDate = DateTime.ParseExact(divDate.TextContent , "MMM dd, yyyy h:mm:sstt" , locale); + + if (File.Exists(exportLocation + href)) + { + messages.Add(new Message { Link = href , Date = parsedDate }); + } } - } + }); } });