# Define the html url url = "http://mp3.baidu.com/" # Get the nokogiri document DOC = nokogiri: HTML (open (URL ))
In centos, the above sentence cannot be parsed, and n writing methods have been tried.
Later I found it was a nokogiri installation problem. If centos5.5 is used, the latest version of libxml2 is still too low. centos is so easy to use and stable, but the library is too old.
Sudo Yum remove-y libxml2 libxslt
Download the latest libxml and libxslt installation here.
Ftp://xmlsoft.org/libxml2/
Gem install/home/Xiao /. rvm/gems/ree-1.8.7-2011.03 @ rails3/Cache/nokogiri-1.4.4.gem -- with-xml2-lib =/opt/libxml2-dev/lib -- with-xml2-include =/opt/libxml2-dev/include/libxml2 -- With-XSLT-Lib =/ OPT/libxslt-dev/lib -- With-XSLT-include =/opt/libxslt-dev/include
Test again, everything is OK.
This is my information.
[Xiao @ bogon collect] $ nokogiri - V
---
Warnings: []
Ruby:
Engine: Ruby
Version: 1.8 . 7
Platform: i686 - Linux
Libxml:
Loaded: 2.7 . 8
Binding: Extension
Compiled: 2.7 . 8
Nokogiri: 1.4 . 4