ASP. NET Core uses Anglesharp crawler images

Source: Internet
Author: User

Anglesharp Introduction

Anglesharp is a DLL component specially developed for parsing HTML source code based on. NET (C #).

The entire DOM has been transferred to the logical class structure. Part of this structure can be resolved as shown. Notice that the picture shows the older DOM model. The current version of Anglesharp implements the latest DOM model, which is slightly different. Nonetheless, the picture is still useful to get the right idea.

Anglesharp is a. Net library that enables you to parse angular-based hypertext, such as Html,svg and MathML . An important aspect of ANGLESHARP is that CSS can also be parsed. The parser is built on the official web-based specifications.

Reference

Http://www.cnblogs.com/pandait/p/AngleSharp.html

Https://www.cnblogs.com/liguobao/p/6130121.html

get Anglesharp with NuGet

The simplest way to integrate Anglesharp into your project is to use NuGet. You can install Anglesharp by opening the Package Manager console (PM) and entering the following statement:

Install-package Anglesharp

You can also use the graphics Library Package Manager ("Manage NuGet packages for solutions"). searching for "Anglesharp" in the official NuGet online source will find this library.

Example
//Create a (reusable) parser front end varParser =NewHtmlparser ();//HTML DOM nodevarSource ="";//Parsing source FilesvarDocument =parser. Parse (source);//Create P tagsvarp = document. CreateElement ("P");p. Textcontent="This is another paragraph.";//Add to Domdocument. Body.appendchild (p);//return full HTMLvarHTML =document. documentelement.outerhtml; viewdata["HTML"] = html;

Effect Show

ASP. NET Core uses Anglesharp crawler images

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.