Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Data extraction collects content, attributes, links, and resources from websites or local HTML documents. With Aspose.HTML for Python via .NET, an application can load HTML, inspect the Document Object Model (DOM), select elements with XPath or CSS selectors, and download linked files such as images or SVG.
Use HTMLDocument to load an HTML source. Navigate its DOM directly or use evaluate() for XPath and query_selector_all() for CSS selectors. Choose the focused guides below when you need to inspect elements, download a known file, or extract image and SVG resources.
Aspose.HTML provides HTML loading, DOM navigation, selector, and network APIs that can be used in a data extraction workflow. The application remains responsible for choosing source URLs, defining selectors, controlling traversal, and storing the extracted results.
| Task | Start with |
|---|---|
| Inspect an HTML document or traverse parent, child, and sibling nodes | DOM traversal in HTML Navigation |
| Select elements by tag, class, ID, or attribute | CSS selectors in HTML Navigation |
| Select nodes by document structure or relationships | XPath queries in HTML Navigation |
| Extract plain text from an HTML file or webpage | Extract Text from HTML |
| Convert a complete HTML source directly to a TXT file | Convert HTML to Text |
| Extract HTML table rows and cells to CSV or TXT | Extract HTML Tables |
| Extract original href values or absolute webpage links | Extract Links from HTML |
| Download a resource from a known URL | Save File from URL |
| Find and save images or page icons | Extract Images from Website |
| Extract inline SVG or download an external SVG file | Extract SVG from Website |
| Issue | Likely cause | What to check |
|---|---|---|
| XPath or CSS selector returns no elements | The selector does not match the DOM loaded from the source. | Inspect the actual document structure and test the selector against available elements and attributes. |
| A relative image, SVG, or file URL cannot be downloaded | The resource reference was used without the document base URL. | Resolve the relative reference against the page URL or document base URI. |
| A downloaded file is empty or contains unexpected data | The request returned an error page, redirect, or another media type. | Check the response status and content type before saving its body. |
| Extraction works differently on another website | HTML structure, generated content, and resource URLs vary between sites. | Treat selectors and resource-handling rules as site-specific and validate them against the loaded document. |
Aspose.HTML is an HTML document-processing API rather than a complete crawling platform. It can load HTML and support extraction through DOM navigation, XPath, CSS selectors, and network operations, while the application controls crawling logic, request scheduling, and data storage.
Use CSS selectors for familiar matching by tag, class, ID, or attribute. Use XPath when selection depends on document hierarchy, node relationships, or path expressions. Both approaches operate on the DOM loaded by the application.
Selectors locate elements and read their text, attributes, or markup from the DOM. Downloading retrieves the resource identified by a URL, such as an image, SVG, or another file. Many extraction workflows first select a resource URL and then download it.
Download complete Python examples and data files from the Aspose.HTML for Python via .NET repository, or use the free HTML Web Applications for quick browser-based HTML tasks without writing code.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.