Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Majestic12;
- class Scraper
- {
- static async Task Main()
- {
- //..
- {
- //...
- // Create an HTML parser instance
- HTMLparser oP = new HTMLparser();
- // Load HTML content
- oP.Init(htmlContent);
- // Find the stock amount element by its class
- HTMLchunk oChunk = null;
- while ((oChunk = oP.ParseNext()) != null)
- {
- if (oChunk.oType == HTMLchunkType.Text)
- {
- if (oChunk.oHTML.Contains("in stock"))
- {
- string stockAmount = oChunk.oHTML;
- Console.WriteLine("Stock Amount: " + stockAmount);
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement