NEWScrapingAnt MCP for Claude Code, Cursor & Windsurf — try it free →
Skip to main content

9 posts tagged with "c#"

View All Tags

How to scrape a dynamic website with Puppeteer-Sharp

· 15 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

How to scrape a dynamic website with Puppeteer-Sharp

Scraping dynamic websites with Puppeteer-Sharp can be challenging for many developers. Puppeteer-Sharp, a .NET port of the Puppeteer library, enables effective browser automation in C#.

This article provides step-by-step guidance on using Puppeteer-Sharp to simplify data extraction from complex web pages. Enhance your web scraping skills now.

How to Build a Web Scraper Using Playwright C#

· 7 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

How to Build a Web Scraper Using Playwright C#

Web scraping has become an essential tool in modern data extraction and automation workflows. Playwright, Microsoft's powerful browser automation framework, has emerged as a leading solution for robust web scraping implementations in C#. This comprehensive guide explores the implementation of web scraping using Playwright, offering developers a thorough understanding of its capabilities and best practices.

Playwright stands out in the automation landscape by offering multi-browser support and superior performance compared to traditional tools like Selenium and Puppeteer (Playwright Documentation). According to recent benchmarks, Playwright demonstrates up to 40% faster execution times compared to Selenium, while providing more reliable wait mechanisms and better cross-browser compatibility.

The framework's modern architecture and sophisticated API make it particularly well-suited for handling dynamic content, complex JavaScript-heavy applications, and single-page applications (SPAs). With support for multiple browser engines including Chromium, Firefox, and WebKit, Playwright offers unparalleled flexibility in web scraping scenarios (Microsoft .NET Blog).

This guide will walk through the essential components of implementing web scraping with Playwright in C#, from initial setup to advanced techniques and performance optimization strategies. Whether you're building a simple data extraction tool or a complex web automation system, this comprehensive implementation guide will provide the knowledge and best practices necessary for successful deployment.

Scrape a Dynamic Website with C++

· 16 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

Scrape a Dynamic Website with C++

Web scraping has become an indispensable tool for acquiring data from websites, especially in the era of big data and data-driven decision-making. However, the complexity of scraping has increased with the advent of dynamic websites, which generate content on-the-fly using JavaScript and AJAX. Unlike static websites, which serve pre-built HTML pages, dynamic websites respond to user interactions and real-time data updates, making traditional scraping techniques ineffective.

To navigate this landscape, developers need to understand the intricacies of client-side and server-side rendering, the role of JavaScript frameworks such as React, Angular, and Vue.js, and the importance of AJAX for asynchronous data loading. This knowledge is crucial for choosing the right tools and techniques to effectively scrape dynamic websites. In this report, we delve into the methodologies for scraping dynamic websites using C++, exploring essential libraries like libcurl, Gumbo, and Boost, and providing a detailed, step-by-step guide to building robust web scrapers.

Scrape a Dynamic Website with C#

· 16 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

Scrape a Dynamic Website with C#

Dynamic websites have become increasingly prevalent due to their ability to deliver personalized and interactive content to users. Unlike static websites, which serve pre-built HTML pages, dynamic websites generate content on-the-fly based on user interactions, database queries, or real-time data. This dynamic nature is achieved through the use of server-side programming languages such as PHP, Ruby, and Python, as well as client-side JavaScript frameworks like React, Angular, and Vue.js.

Dynamic websites are characterized by asynchronous content loading, client-side rendering, real-time updates, personalized content, and complex DOM structures. These features enhance user experience but also introduce significant challenges for web scraping. Traditional scraping tools that rely on static HTML parsing often fall short when dealing with dynamic websites, necessitating the use of more sophisticated methods and tools.

To effectively scrape dynamic websites using C#, developers must employ specialized tools such as Selenium WebDriver and PuppeteerSharp, which can interact with web pages as if they were real users, executing JavaScript and waiting for content to load. These tools, along with proper wait mechanisms and dynamic element location strategies, enable the extraction of data from even the most complex and interactive web applications.

How to Parse XML in C++: Tested Examples and Library Choices

· 13 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

How to Parse XML in C++

Updated 2026-10-07

Replaced placeholder code with compiled C++17 examples and captured failure cases, corrected the TinyXML-2 naming and documentation links, and removed unsupported speed comparisons and unrelated compiler theory. Download the tested source, fixtures, and outputs.

To parse XML in C++, use a library to read the document, check the parse result, and then validate the fields your application requires. A successful parse alone does not tell you whether a record has a title, whether an ID is an integer, or whether the document is safe to process.

This guide starts with a complete pugixml file parser that extracts book IDs and titles. A smaller TinyXML-2 example shows how to parse a string. The library comparison explains when to move to Xerces-C++, libxml2, or libxml++ for namespaces, validation, or streaming. No scraping API is needed to parse XML you already have.

How to Parse HTML in C++

· 15 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

How to Parse HTML in C++

HTML parsing is a fundamental process in web development and data extraction. It involves breaking down HTML documents into their constituent elements, allowing for easy manipulation and analysis of the structure and content. In the context of C++, HTML parsing can be particularly advantageous due to the language's high performance and low-level control. However, the process also presents challenges, such as handling nested elements, malformed HTML, and varying HTML versions.

This comprehensive guide aims to provide an in-depth exploration of HTML parsing in C++. It covers essential concepts such as tokenization, tree construction, and DOM (Document Object Model) representation, along with practical code examples. We will delve into various parsing techniques, discuss performance considerations, and highlight best practices for robust error handling. Furthermore, we will review some of the most popular HTML parsing libraries available for C++, including Gumbo Parser, libxml++, Boost.Beast, MyHTML, and TinyXML-2, to help developers choose the best tool for their specific needs.

How to Download Images in C# with HttpClient

· 9 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

How to download images with C#?

Updated 2026-10-08

Replaced repeated snippets and unsupported timing comparisons with a complete HttpClient program and owned PNG/JPEG failure tests. Corrected legacy API guidance and added body-size limits, body cancellation and temporary-file cleanup. Runnable evidence.

To download an image from a URL in C#, use HttpClient to request the bytes and save them to a file. For a bounded download, inspect the status and content type, stream the body with a byte limit and cancellation token, and publish the destination only after the transfer passes your checks.

The program below accepts PNG and JPEG responses. It checks their declared media type and leading signature bytes, preserves an existing destination and removes temporary bytes when a transfer fails. Those checks are useful format filters; they do not fully decode an image or prove that arbitrary content is safe.

How to Parse HTML in C# with AngleSharp and Html Agility Pack

· 8 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

How to parse HTML in .NET

Updated 2026-10-08

Replaced incomplete snippets and broad speed claims with a runnable CSS/XPath extraction example, captured JSON and explicit failure controls. The evidence packet records the tested versions and limits.

To parse HTML in C#, use an HTML parser to build a document, select the elements you need, then convert their text and attributes into validated records. AngleSharp provides CSS selectors and a DOM-style API; Html Agility Pack provides XPath selection. The right starting point is usually the selector language your application already uses.

This tutorial extracts the same product records with both libraries. It covers relative URLs, encoded text, selectors that match nothing and records with missing fields. The example parses HTML already supplied to the application; fetching a page and executing its JavaScript are separate steps.

HTML Parsing Libraries - C#

· 5 min read
Oleg Kulyk
Co-Founder @ ScrapingAnt

HTML Parsing Libraries - C#

Web sites are written using HTML, which means that each web page is a structured document. Sometimes the goal is to obtain some data from them and preserve the structure while we’re at it. Websites don’t always provide their data in comfortable formats such as CSV or JSON, so only the way to deal with it is to parse the HTML page.