Use TFHpple to parse html
Preparatory work
Introduce static library files
Add the header search paths of the library file (note, All must be selected)
Drag the source code package downloaded from github into the project
End of preparation
Usage details
Let’s parse the title tag in the URL.
The idea is like this:
1. Convert the web page into NSData
2. Query the data in NSData according to the tag value
3. Retrieve the desired data
Print information is as follows:
2014-05-16 11:34:19.227 Html[ 3736:60b]
Let’s come The parsing is more complex, such as parsing out all the summary information in the web page.
Node
Node attributes
Node attribute value
Node content
The rest is easy!so easy!
The above is the detailed content of Detailed graphic explanation of how to use TFHpple to parse HTML. For more information, please follow other related articles on the PHP Chinese website!