Another technology brings everyone into the discussion of information collection

Source: Internet
Author: User

Before talking about it, let's talk about how the general method is implemented,

I want to believe that most interviewersUse regular expressions to collect data

Indeed, this is a method that the masses have come up. it cannot be wrong. It can only be said that his collection efficiency and the collected content require most of them to write very complicated processing logic, and I believe that everyone is in college, it is not easy to learn regular expressions at work. I think the regular expression is difficult.

 

Today, we will introduce a new method: HTML agility pack.You can download it from your website. I will not talk about it here...

HTML agility pack is a tool developed by Simon mourier, a French software architect and developed by darthobiwan and jessynoo, it makes HTML analysis as simple as XML analysis, and it is similar to system. in addition to hierarchical access to HTML, many classes of xml dom in XML Namespaces also support searching for HTML using XPath, this is clearer than the previous comparison methods using text comparison or regular expression.

 

Let's take a lookHTML agility packHow to interpret the plain web pages such as www.baidu.comSite if I want to collectNews WebpagePost it Yes MP3This title text

As shown in figure...HTML agility packConvert to the lower right corner of the XPath formatXPath is the path value we want to collect. The path value is the value you want to collect.

You can also try to identify tags and record the tags to be collected.Blog is easy to understand. I don't know why...

 

The following is a small tool I have written.

 

 

 

 

The above figure shows the record XPath to be collected, because some XPath collections also have special symbols in the collection,

 

We will add a regular expression filtering method below the corresponding, so that we can better handle the problem.

 

Let's talk about it today ,,,CollectionCodeLet's talk about it later, and let's talk about our ideas.

 

Let's take a look at it .........................

 

 

 

 

 

 

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.