I want to convert the base64 data I have to html type, when I do this conversion, the html file comes out as corrupted and I cannot do scraping with Agility pack. But when I do the conversion manually with an online tool on the internet, the html file comes up properly and I can scrape. My codes are as follows. Please help
string base64Data = "//Base64 in here"; byte[] decodedBytes = Convert.FromBase64String(base64Data); string decodedText = Encoding.UTF8.GetString(decodedBytes); string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); string filePath = Path.Combine(desktopPath, "decoded_data.html"); File.WriteAllText(filePath, decodedText); filePath = Path.Combine(desktopPath, "decoded_data.html"); HtmlWeb htmlWeb = new HtmlWeb(); HtmlDocument doc = htmlWeb.Load(filePath); HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//body//table[1]//tr[2]//td[2]//tr[3]//td[2]"); foreach (HtmlNode node in nodes) { Console.WriteLine(node.InnerText); }